public interface Codec
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
|
void encode(Object object, OutputStream outputStream) throws IOException
object
- the object to encodeoutputStream
- the OutputStreamIOException
- if the operation failsbyte[] encode(Object object) throws IOException
object
- the object to encodeIOException
- if the operation fails<T> T decode(InputStream inputStream, Class<T> type) throws IOException
T
- the object's typeinputStream
- the input stream containing the encoded objecttype
- the object's classIOException
- if the operation fails<T> T decode(byte[] bytes, Class<T> type) throws IOException
T
- the object's typebytes
- the byte array containing the encoded objecttype
- the object's classIOException
- if the operation fails