Interface ObjectFormatter
-
public interface ObjectFormatterAn interface to define methods for encoding and decoding objects and their keys.- Since:
- 4.0
- Author:
- Anindya Chatterjee
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> Tdecode(byte[] bytes, Class<T> type)Decodes a byte array into an object of the specified type.<T> TdecodeKey(byte[] bytes, Class<T> type)Decodes a byte array into an object's key of the specified type.<T> byte[]encode(T object)Encodes an object into a byte array.<T> byte[]encodeKey(T object)Encodes an object's key into a byte array.
-
-
-
Method Detail
-
encode
<T> byte[] encode(T object)
Encodes an object into a byte array.- Type Parameters:
T- the type of the object- Parameters:
object- the object to encode- Returns:
- the byte array representing the encoded object
-
encodeKey
<T> byte[] encodeKey(T object)
Encodes an object's key into a byte array.- Type Parameters:
T- the type of the object- Parameters:
object- the object whose key to encode- Returns:
- the byte array representing the encoded key
-
decode
<T> T decode(byte[] bytes, Class<T> type)Decodes a byte array into an object of the specified type.- Type Parameters:
T- the type of the object- Parameters:
bytes- the byte array to decodetype- the type of the object to decode- Returns:
- the decoded object
-
decodeKey
<T> T decodeKey(byte[] bytes, Class<T> type)Decodes a byte array into an object's key of the specified type.- Type Parameters:
T- the type of the object's key- Parameters:
bytes- the byte array to decodetype- the type of the object's key to decode- Returns:
- the decoded object's key
-
-