avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pratyush Chandra <chandra.praty...@gmail.com>
Subject Embedding schema with binary encoding
Date Mon, 07 Jan 2013 12:42:15 GMT
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
GenericDatumWriter<GenericRecord>(schema);
        GenericRecord message1= new GenericData.Record(schema);
        message1.put("to", "Alyssa");
        datumWriter.write(message1, e);
        e.flush();
        outputStream.close();

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

Thanks
Pratyush Chandra

Mime
View raw message