public class ObjectSerializer extends ObjectSerializer
OBJECT_MAPPER
Constructor and Description |
---|
ObjectSerializer() |
Modifier and Type | Method and Description |
---|---|
<T> T |
deserialize(byte[] content,
Class<T> clazz)
Deserializes the byte array into the original object.
|
byte[] |
serialize(Object state)
Serializes a given state object into byte array.
|
byte[] |
unwrapData(byte[] payload)
Extracts the response data from a JSON Payload where data is in "data" attribute.
|
byte[] |
wrapData(byte[] data)
Wraps data in the "data" attribute in a JSON object.
|
public byte[] serialize(Object state) throws IOException
serialize
in class ObjectSerializer
state
- State object to be serialized.IOException
- In case state cannot be serialized.public <T> T deserialize(byte[] content, Class<T> clazz) throws IOException
deserialize
in class ObjectSerializer
T
- Generic type of the object being deserialized.content
- Content to be parsed.clazz
- Type of the object being deserialized.IOException
- In case content cannot be deserialized.public byte[] unwrapData(byte[] payload) throws IOException
payload
- JSON payload containing "data".IOException
- In case it cannot generate String.public byte[] wrapData(byte[] data) throws IOException
data
- bytes to be wrapped into the "data" attribute in a JSON object.IOException
- If there's is any issue reading the data or wraping itCopyright © 2020. All rights reserved.