Class SerializationDelegate
java.lang.Object
org.springframework.core.serializer.support.SerializationDelegate
- All Implemented Interfaces:
Deserializer<Object>
,Serializer<Object>
public class SerializationDelegate
extends Object
implements Serializer<Object>, Deserializer<Object>
A convenient delegate with pre-arranged configuration state for common
serialization needs. Implements
Serializer
and Deserializer
itself, so can also be passed into such more specific callback methods.- Since:
- 4.3
- Author:
- Juergen Hoeller
-
Constructor Summary
ConstructorDescriptionSerializationDelegate
(ClassLoader classLoader) Create aSerializationDelegate
with a default serializer/deserializer for the givenClassLoader
.SerializationDelegate
(Serializer<Object> serializer, Deserializer<Object> deserializer) Create aSerializationDelegate
with the given serializer/deserializer. -
Method Summary
Modifier and TypeMethodDescriptiondeserialize
(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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.core.serializer.Deserializer
deserializeFromByteArray
Methods inherited from interface org.springframework.core.serializer.Serializer
serializeToByteArray
-
Constructor Details
-
SerializationDelegate
Create aSerializationDelegate
with a default serializer/deserializer for the givenClassLoader
. -
SerializationDelegate
Create aSerializationDelegate
with the given serializer/deserializer.- Parameters:
serializer
- theSerializer
to use (nevernull)
deserializer
- theDeserializer
to use (nevernull)
-
-
Method Details
-
serialize
Description copied from interface:Serializer
Write an object of type T to the given OutputStream.Note: Implementations should not close the given OutputStream (or any decorators of that OutputStream) but rather leave this up to the caller.
- Specified by:
serialize
in interfaceSerializer<Object>
- Parameters:
object
- the object to serializeoutputStream
- the output stream- Throws:
IOException
- in case of errors writing to the stream
-
deserialize
Description copied from interface:Deserializer
Read (assemble) an object of type T from the given InputStream.Note: Implementations should not close the given InputStream (or any decorators of that InputStream) but rather leave this up to the caller.
- Specified by:
deserialize
in interfaceDeserializer<Object>
- Parameters:
inputStream
- the input stream- Returns:
- the deserialized object
- Throws:
IOException
- in case of errors reading from the stream
-