public class JdkSerializer extends 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 ObjectInputStream |
createObjectInput(InputStream inputStream,
Class<?> requiredType) |
protected ObjectOutputStream |
createObjectOutput(OutputStream outputStream) |
<T> Optional<T> |
deserialize(InputStream inputStream,
Class<T> requiredType)
Deserialize the given object to bytes.
|
void |
serialize(Object object,
OutputStream outputStream)
Serialize the given object to a byte[].
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
deserialize, deserialize, serialize
public JdkSerializer(ConversionService<?> conversionService)
conversionService
- The conversion servicepublic JdkSerializer()
public void serialize(Object object, OutputStream outputStream) throws SerializationException
ObjectSerializer
serialize
in interface ObjectSerializer
object
- The object to serializeoutputStream
- The output streamSerializationException
- if there is a serialization problempublic <T> Optional<T> deserialize(InputStream inputStream, 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 problemprotected ObjectOutputStream createObjectOutput(OutputStream outputStream) throws IOException
outputStream
- The output streamObjectOutputStream
IOException
- if there is an errorprotected ObjectInputStream createObjectInput(InputStream inputStream, Class<?> requiredType) throws IOException
inputStream
- The input streamrequiredType
- The required typeObjectOutputStream
IOException
- if there is an error