Examples of TupleInputStream


Examples of cascading.tuple.io.TupleInputStream

    dataOutputStream.writeTuple( aTuple );

    dataOutputStream.flush();

    ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream( byteArrayOutputStream.toByteArray() );
    TupleInputStream dataInputStream = new HadoopTupleInputStream( byteArrayInputStream, new TupleSerialization().getElementReader() );

    Tuple newTuple = new Tuple();

    dataInputStream.readTuple( newTuple );

    assertEquals( aTuple, newTuple );
    }
View Full Code Here

Examples of cascading.tuple.io.TupleInputStream

    output.close();

    assertEquals( "wrong size", 89967L, file.length() ); // just makes sure the file size doesnt change from expected

    TupleInputStream input = new HadoopTupleInputStream( new FileInputStream( file ), tupleSerialization.getElementReader() );

    int k = -1;
    for( int i = 0; i < 501; i++ )
      {
      Tuple tuple = input.readTuple();
      int value = tuple.getInteger( 0 );
      assertTrue( "wrong diff", value - k == 1 );
      assertTrue( "wrong type", tuple.getObject( 3 ) instanceof TestText );
      assertTrue( "wrong type", tuple.getObject( 4 ) instanceof Tuple );
      assertTrue( "wrong type", tuple.getObject( 5 ) instanceof BytesWritable );

      byte[] bytes = ( (BytesWritable) tuple.getObject( 5 ) ).getBytes();
      String string = new String( bytes, 0, bytes.length > 1 ? bytes.length - 1 : bytes.length, "UTF-8" );
      assertEquals( "wrong value", Integer.parseInt( string ), i );
      assertTrue( "wrong type", tuple.getObject( 6 ) instanceof BooleanWritable );
      k = value;
      }

    input.close();

    System.out.println( "time = " + ( System.currentTimeMillis() - time ) );
    }
View Full Code Here

Examples of cascading.tuple.io.TupleInputStream

  public Tuple deserialize(byte[] bytes) throws IOException {
    initDeserializer();
    Tuple tuple = new Tuple();
    ByteArrayInputStream inputStream = new ByteArrayInputStream(bytes);
    TupleInputStream tupleInputStream = new HadoopTupleInputStream(inputStream, serialization.getElementReader());
    tupleDeserializer.open(tupleInputStream);
    tupleDeserializer.deserialize(tuple);
    return tuple;
  }
View Full Code Here

Examples of uk.org.ogsadai.tuple.serialise.TupleInputStream

    public void deserialise(InputStream input, BlockWriter writer)
        throws PipeClosedException, PipeIOException, PipeTerminatedException
    {
        try
        {
            TupleInputStream tuples = new TupleInputStream(input);
            writer.write(new MetadataWrapper(tuples.readTupleMetadata()));
            while (true)
            {
                Tuple tuple = tuples.readTuple();
                writer.write(tuple);
            }
        }
        catch (EOFException e)
        {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.