File file = new File( getOutputPath( "serialization" ) );
file.mkdirs();
file = new File( file, "/test.bytes" );
TupleOutputStream output = new HadoopTupleOutputStream( new FileOutputStream( file, false ), tupleSerialization.getElementWriter() );
for( int i = 0; i < 501; i++ ) // 501 is arbitrary
{
String aString = "string number " + i;
double random = Math.random();
output.writeTuple( new Tuple( i, aString, random, new TestText( aString ), new Tuple( "inner tuple", new BytesWritable( "some string".getBytes() ) ), new BytesWritable( Integer.toString( i ).getBytes( "UTF-8" ) ), new BooleanWritable( false ) ) );
}
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() );