T
- the type of object that is encoded and decoded.public interface DatatypeCodec<T>
Interface defining a datatype codec.
Implementations of this interface must be public (and static, if an inner class) and have a public no-argument constructor.
DatatypeCodecType
Modifier and Type | Method and Description |
---|---|
T |
decode(DataInput in,
ClassLoader cl,
DecoderUtils utils)
Decode a value from the given data input stream.
|
void |
encode(T value,
DataOutput out,
EncoderUtils utils)
Encode the specified value to the given data output stream.
|
void encode(T value, DataOutput out, EncoderUtils utils) throws IOException
Encode the specified value to the given data output stream.
value
- the value to encode.
This will never be null
.out
- the data output stream to encode the value to.utils
- additional utility encoding functions that may be useful to the codec.IOException
- if an I/O error occurs.T decode(DataInput in, ClassLoader cl, DecoderUtils utils) throws IOException
Decode a value from the given data input stream.
in
- the data input stream to decode the value from.cl
- a classloader which can be used to load classes necessary to decode the value.utils
- additional utility decoding functions that may be useful to the codec.IOException
- if an I/O error occurs.