Constructor and Description |
---|
CompositeCodec(Codec defaultCodec) |
CompositeCodec(Map<Class<?>,Codec> delegates,
Codec defaultCodec) |
Modifier and Type | Method and Description |
---|---|
<T> T |
decode(byte[] bytes,
Class<T> type)
Decode an object of a given type
|
<T> T |
decode(InputStream inputStream,
Class<T> type)
Decode an object of a given type
|
byte[] |
encode(Object object)
Encode an object to a byte array
|
void |
encode(Object object,
OutputStream outputStream)
Encode (encode) an object to an OutputStream
|
public CompositeCodec(Codec defaultCodec)
public void encode(Object object, OutputStream outputStream) throws IOException
Codec
encode
in interface Codec
object
- the object to encodeoutputStream
- the OutputStreamIOException
- if the operation failspublic byte[] encode(Object object) throws IOException
Codec
encode
in interface Codec
object
- the object to encodeIOException
- if the operation failspublic <T> T decode(InputStream inputStream, Class<T> type) throws IOException
Codec
decode
in interface Codec
T
- the object's typeinputStream
- the input stream containing the encoded objecttype
- the object's classIOException
- if the operation failspublic <T> T decode(byte[] bytes, Class<T> type) throws IOException
Codec
decode
in interface Codec
T
- the object's typebytes
- the byte array containing the encoded objecttype
- the object's classIOException
- if the operation fails