public class JdkSerializer extends java.lang.Object implements ObjectSerializer
ObjectSerializer
that uses JDK serialization.JDK
Constructor and Description |
---|
JdkSerializer()
Default constructor.
|
JdkSerializer(ConversionService<?> conversionService) |
Modifier and Type | Method and Description |
---|---|
protected java.io.ObjectInputStream |
createObjectInput(java.io.InputStream inputStream,
java.lang.Class<?> requiredType) |
protected java.io.ObjectOutputStream |
createObjectOutput(java.io.OutputStream outputStream) |
<T> java.util.Optional<T> |
deserialize(java.io.InputStream inputStream,
Argument<T> requiredType)
Deserialize the given object to bytes.
|
<T> java.util.Optional<T> |
deserialize(java.io.InputStream inputStream,
java.lang.Class<T> requiredType)
Deserialize the given object to bytes.
|
void |
serialize(java.lang.Object object,
java.io.OutputStream outputStream)
Serialize the given object to a byte[].
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
deserialize, deserialize, deserialize, serialize
public JdkSerializer(ConversionService<?> conversionService)
conversionService
- The conversion servicepublic JdkSerializer()
public void serialize(java.lang.Object object, java.io.OutputStream outputStream) throws SerializationException
ObjectSerializer
serialize
in interface ObjectSerializer
object
- The object to serializeoutputStream
- The output streamSerializationException
- if there is a serialization problempublic <T> java.util.Optional<T> deserialize(java.io.InputStream inputStream, java.lang.Class<T> requiredType) throws SerializationException
ObjectSerializer
deserialize
in interface ObjectSerializer
T
- The required generic typeinputStream
- The input streamrequiredType
- The required typeOptional
of the objectSerializationException
- if there is a serialization problempublic <T> java.util.Optional<T> deserialize(java.io.InputStream inputStream, Argument<T> requiredType) throws SerializationException
ObjectSerializer
deserialize
in interface ObjectSerializer
T
- The required generic typeinputStream
- The input streamrequiredType
- The required typeOptional
of the objectSerializationException
- if there is a serialization problemprotected java.io.ObjectOutputStream createObjectOutput(java.io.OutputStream outputStream) throws java.io.IOException
outputStream
- The output streamObjectOutputStream
java.io.IOException
- if there is an errorprotected java.io.ObjectInputStream createObjectInput(java.io.InputStream inputStream, java.lang.Class<?> requiredType) throws java.io.IOException
inputStream
- The input streamrequiredType
- The required typeObjectOutputStream
java.io.IOException
- if there is an error