Here's my use case: I've got a bunch of different Java objects generated from Avro schema files. So the class definition headers look something like this: public class MyObject extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord. I've got many other types than MyObject too. I need to write a method which can serialize (from MyObject or another class to byte) and deserialize (from byte to MyObject or another class) in memory (not writing to disk).
I couldn't figure out how to write one method to handle it for SpecificRecord, so I tired serializing/deserializing these things as GenericRecord instead: