on-internet
← Community

How to Serialize Avro to a byte array using Avro c# library?

Stack Overflow ·

I am looking for a way to serialize Avro to a byte array in Avro C# library. There is a link to do for Avro Java library as described in following link from Avro documentation: https://cwiki.apache.org/confluence/display/AVRO/FAQ#FAQ-Serializingtoabytearray Code copied from above link: ByteArrayOutputStream out = new ByteArrayOutputStream(); BinaryEncoder encoder = EncoderFactory.get().binaryEncoder(out, null); DatumWriter<User> writer = new SpecificDatumWriter<User>(User.getClassSchema()); writer.write(user, encoder); encoder.flush(); out.close(); byte[] serializedBytes = out.toByteArray(); B

Comments

Sign in or sign up to comment and upvote.

No comments yet.