FileOutputStream outputStream = new FileOutputStream(new File("target/temp.avro"));
// Write a marker followed by each record: <'apple', TextStats('apple')> and <'banana', TextStats('banana')>.
AvroKeyValueRecordWriter<Text, AvroValue<TextStats>> writer
= new AvroKeyValueRecordWriter<Text, AvroValue<TextStats>>(keyConverter, valueConverter,
new ReflectData(), compressionCodec, outputStream);
TextStats appleStats = new TextStats();
appleStats.name = "apple";
long pointOne = writer.sync();
writer.write(new Text("apple"), new AvroValue<TextStats>(appleStats));
TextStats bananaStats = new TextStats();