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, waitdeserialize, deserialize, serializepublic JdkSerializer(ConversionService<?> conversionService)
conversionService - The conversion servicepublic JdkSerializer()
public void serialize(Object object, OutputStream outputStream) throws SerializationException
ObjectSerializerserialize in interface ObjectSerializerobject - The object to serializeoutputStream - The output streamSerializationException - if there is a serialization problempublic <T> Optional<T> deserialize(InputStream inputStream, Class<T> requiredType) throws SerializationException
ObjectSerializerdeserialize in interface ObjectSerializerT - 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 streamObjectOutputStreamIOException - if there is an errorprotected ObjectInputStream createObjectInput(InputStream inputStream, Class<?> requiredType) throws IOException
inputStream - The input streamrequiredType - The required typeObjectOutputStreamIOException - if there is an error