public interface ObjectSerializer
Modifier and Type | Field and Description |
---|---|
static ObjectSerializer |
JDK
The default JDK serializer.
|
Modifier and Type | Method and Description |
---|---|
default Optional<Object> |
deserialize(byte[] bytes)
Deserialize the given object to bytes.
|
default <T> Optional<T> |
deserialize(byte[] bytes,
Class<T> requiredType)
Deserialize the given object to bytes.
|
<T> Optional<T> |
deserialize(InputStream inputStream,
Class<T> requiredType)
Deserialize the given object to bytes.
|
default Optional<byte[]> |
serialize(Object object)
Serialize the given object to a byte[].
|
void |
serialize(Object object,
OutputStream outputStream)
Serialize the given object to a byte[].
|
static final ObjectSerializer JDK
void serialize(@Nullable Object object, OutputStream outputStream) throws SerializationException
object
- The object to serializeoutputStream
- The output streamSerializationException
- if there is a serialization problem<T> Optional<T> deserialize(@Nullable InputStream inputStream, Class<T> requiredType) throws SerializationException
T
- The required generic typeinputStream
- The input streamrequiredType
- The required typeOptional
of the objectSerializationException
- if there is a serialization problemdefault Optional<byte[]> serialize(@Nullable Object object) throws SerializationException
object
- The object to serializeSerializationException
- if there is a serialization problemdefault <T> Optional<T> deserialize(@Nullable byte[] bytes, Class<T> requiredType) throws SerializationException
T
- The required generic typebytes
- The byte arrayrequiredType
- The required typeOptional
of the objectSerializationException
- if there is a serialization problemdefault Optional<Object> deserialize(@Nullable byte[] bytes) throws SerializationException
bytes
- The byte arrayOptional
of the objectSerializationException
- if there is a serialization problem