public static < T > void writeAvroEntity ( T entity , Encoder encoder , DatumWriter < T > writer ) { try { writer . write ( entity , encoder ) ; encoder . flush ( ) ; } catch ( IOException e ) { throw new SerializationException ( "Could not serialize Avro entity" , e ) ; } }
Given an entity an avro schema and an encoder write the entity to the encoder s underlying output stream .