...
Serializing to a byte array
This example function takes a User object and returns a newly allocated byte array with the Avro serialization of that user.
...
Deserializing from a byte array
This example function takes a byte array containing the Avro serialization of a user and returns a User object.SpecificDatumReader<User>
...
reader
...
=
...
new
...
SpecificDatumReader<User>(User.getClassSchema());
Decoder decoder = DecoderFactory.get().binaryDecoder(bytes, null);
User user = reader.read(null, decoder);
...