public class SerializationDelegate extends Object implements Serializer<Object>, Deserializer<Object>
Serializer
and Deserializer
itself, so can also be passed into such more specific callback methods.Constructor and Description |
---|
SerializationDelegate(ClassLoader classLoader)
Create a
SerializationDelegate with a default serializer/deserializer
for the given ClassLoader . |
SerializationDelegate(Serializer<Object> serializer,
Deserializer<Object> deserializer)
Create a
SerializationDelegate with the given serializer/deserializer. |
Modifier and Type | Method and Description |
---|---|
Object |
deserialize(InputStream inputStream)
Read (assemble) an object of type T from the given InputStream.
|
void |
serialize(Object object,
OutputStream outputStream)
Write an object of type T to the given OutputStream.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
serializeToByteArray
deserializeFromByteArray
public SerializationDelegate(ClassLoader classLoader)
SerializationDelegate
with a default serializer/deserializer
for the given ClassLoader
.public SerializationDelegate(Serializer<Object> serializer, Deserializer<Object> deserializer)
SerializationDelegate
with the given serializer/deserializer.serializer
- the Serializer
to use (never null)
deserializer
- the Deserializer
to use (never null)
public void serialize(Object object, OutputStream outputStream) throws IOException
Serializer
Note: Implementations should not close the given OutputStream (or any decorators of that OutputStream) but rather leave this up to the caller.
serialize
in interface Serializer<Object>
object
- the object to serializeoutputStream
- the output streamIOException
- in case of errors writing to the streampublic Object deserialize(InputStream inputStream) throws IOException
Deserializer
Note: Implementations should not close the given InputStream (or any decorators of that InputStream) but rather leave this up to the caller.
deserialize
in interface Deserializer<Object>
inputStream
- the input streamIOException
- in case of errors reading from the stream