Package io.hekate.codec
Interface EncoderDecoder<T>
-
- Type Parameters:
T
- Base type of objects that can be encoded/decoded.
public interface EncoderDecoder<T>
Interface for components that can perform encoding/decoding operations.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
decode(byte[] bytes)
Decodes an object from the specified array of bytes.T
decode(byte[] bytes, int offset, int limit)
Decodes an object from the specified array of bytes.T
decode(DataReader in)
Decodes an object from the specified reader.T
decode(InputStream in)
Decodes an object from the specified stream.byte[]
encode(T obj)
Encodes the specified object into an array of bytes.void
encode(T obj, DataWriter out)
Encodes the specified object into the specified writer.void
encode(T obj, OutputStream out)
Encodes the specified object into the specified stream.
-
-
-
Method Detail
-
encode
void encode(T obj, OutputStream out) throws CodecException
Encodes the specified object into the specified stream.- Parameters:
obj
- Object.out
- Stream.- Throws:
CodecException
- Signals encoding failure.- See Also:
decode(InputStream)
-
encode
void encode(T obj, DataWriter out) throws CodecException
Encodes the specified object into the specified writer.- Parameters:
obj
- Object.out
- Writer.- Throws:
CodecException
- Signals encoding failure.- See Also:
decode(DataReader)
-
encode
byte[] encode(T obj) throws CodecException
Encodes the specified object into an array of bytes.- Parameters:
obj
- Object.- Returns:
- Bytes.
- Throws:
CodecException
- Signals encoding failure.- See Also:
decode(byte[])
-
decode
T decode(InputStream in) throws CodecException
Decodes an object from the specified stream.- Parameters:
in
- Stream to read data from.- Returns:
- Decoded object.
- Throws:
CodecException
- Signals decoding failure.- See Also:
encode(Object, OutputStream)
-
decode
T decode(DataReader in) throws CodecException
Decodes an object from the specified reader.- Parameters:
in
- Reader.- Returns:
- Decoded object.
- Throws:
CodecException
- Signals decoding failure.- See Also:
encode(Object, DataWriter)
-
decode
T decode(byte[] bytes) throws CodecException
Decodes an object from the specified array of bytes.- Parameters:
bytes
- Bytes.- Returns:
- Decoded object.
- Throws:
CodecException
- Signals decoding failure.
-
decode
T decode(byte[] bytes, int offset, int limit) throws CodecException
Decodes an object from the specified array of bytes.- Parameters:
bytes
- Bytes.offset
- Offset of the first byte to read.limit
- Maximum number of bytes to read.- Returns:
- Decoded object.
- Throws:
CodecException
- Signals decoding failure.
-
-