Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Avro >> mail # user >> Embedding schema with binary encoding

Copy link to this message
Embedding schema with binary encoding
I am able to serialize with binary encoding to a file using following :
        FileOutputStream outputStream = new FileOutputStream(file);
        Encoder e = EncoderFactory.get().binaryEncoder(outputStream, null);
        DatumWriter<GenericRecord> datumWriter = new
        GenericRecord message1= new GenericData.Record(schema);
        message1.put("to", "Alyssa");
        datumWriter.write(message1, e);

But the output file contains only serialized data and not schema. How can I
add schema also ?

Pratyush Chandra