Package io.dapr.serializer
Interface DaprObjectSerializer
- All Known Implementing Classes:
DefaultObjectSerializer
public interface DaprObjectSerializer
Serializes and deserializes application's objects.
-
Method Summary
Modifier and Type Method Description <T> T
deserialize(byte[] data, TypeRef<T> type)
Deserializes the given byte[] into a object.java.lang.String
getContentType()
Returns the content type of the request.byte[]
serialize(java.lang.Object o)
Serializes the given object as byte[].
-
Method Details
-
serialize
byte[] serialize(java.lang.Object o) throws java.io.IOExceptionSerializes the given object as byte[].- Parameters:
o
- Object to be serialized.- Returns:
- Serialized object.
- Throws:
java.io.IOException
- If cannot serialize.
-
deserialize
Deserializes the given byte[] into a object.- Type Parameters:
T
- Type of object to be deserialized.- Parameters:
data
- Data to be deserialized.type
- Type of object to be deserialized.- Returns:
- Deserialized object.
- Throws:
java.io.IOException
- If cannot deserialize object.
-
getContentType
java.lang.String getContentType()Returns the content type of the request.- Returns:
- content type of the request
-