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