Interface Serdes<T>
-
- Type Parameters:
T
- the data-type to serialize/deserialize.
- All Superinterfaces:
AutoCloseable
,Closeable
,Configurable
- All Known Implementing Classes:
SpecificJsonSerdes
public interface Serdes<T> extends Configurable, Closeable, AutoCloseable
Interface for serializing and de-serializing object.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default void
close()
Close thisSerdes
.default void
configure(Conf configuration)
Configure thisSerdes
.String
contentType()
Get the content-type attached to thisSerdes
.T
deserialize(byte[] data)
Deserialize data from a byte array into a value or object.byte[]
serialize(T object)
Serialize a data object into a byte array.
-
-
-
Method Detail
-
configure
default void configure(Conf configuration)
Configure thisSerdes
.- Specified by:
configure
in interfaceConfigurable
- Parameters:
configuration
- theConf
instance used to configure this instance.
-
contentType
String contentType()
Get the content-type attached to thisSerdes
.- Returns:
- a string representing the content-type.
-
serialize
byte[] serialize(T object) throws SerializationException
Serialize a data object into a byte array.- Parameters:
object
- the data object to convert; may be null.- Returns:
- the serialized data byte array; may be null
- Throws:
SerializationException
-
deserialize
T deserialize(byte[] data) throws SerializationException
Deserialize data from a byte array into a value or object.- Parameters:
data
- the data byte array to deserialize; may be null.- Returns:
- the deserialized typed data; may be null
- Throws:
SerializationException
-
close
default void close()
Close thisSerdes
.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
-