All Implemented Interfaces:
Codec <T>
public class AvroMessageCodec<T>
extends Object
implements Codec <T>
Avro Single object encoding: magic 2 bytes + schema fingerprint 8 bytes + avro binary. See
https://avro.apache.org/docs/current/spec.html#single_object_encoding When using a SchemaStore the writer and reader
schemas can evolve.
Since:
10.2
Field Summary
Fields
protected final org.apache.avro.message.BinaryMessageDecoder<T >
protected final org.apache.avro.message.BinaryMessageEncoder<T >
protected final org.apache.avro.Schema
Constructor Summary
Constructors
Method Summary
All Methods Instance Methods Concrete Methods
Decodes the byte array returns an object.
byte[]
Encodes the object returns a byte array representation.
Methods inherited from class java.lang.Object
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait
Field Details
NAME
public static final String NAME
See Also:
messageClass
protected final Class <T > messageClass
schema
protected final org.apache.avro.Schema schema
encoder
protected final org.apache.avro.message.BinaryMessageEncoder<T > encoder
decoder
protected final org.apache.avro.message.BinaryMessageDecoder<T > decoder
Constructor Details
AvroMessageCodec
public AvroMessageCodec (Class <T > messageClass)
Method Details
getName
Description copied from interface: Codec
Returns the codec name
Specified by:
getName
in interface Codec <T >
encode
public byte[] encode (T object)
Description copied from interface: Codec
Encodes the object returns a byte array representation.
Specified by:
encode
in interface Codec <T >
decode
public T decode (byte[] data)
Description copied from interface: Codec
Decodes the byte array returns an object.
Specified by:
decode
in interface Codec <T >