类 SerializationDelegate
- java.lang.Object
- org.springframework.core.serializer.support.SerializationDelegate
- 所有已实现的接口:
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. ImplementsSerializer
andDeserializer
itself, so can also be passed into such more specific callback methods.- 从以下版本开始:
- 4.3
- 作者:
- Juergen Hoeller
构造器概要
构造器 构造器 说明 SerializationDelegate(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.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 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.从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 org.springframework.core.serializer.Deserializer
deserializeFromByteArray
从接口继承的方法 org.springframework.core.serializer.Serializer
serializeToByteArray
构造器详细资料
SerializationDelegate
public SerializationDelegate(ClassLoader classLoader)
Create aSerializationDelegate
with a default serializer/deserializer for the givenClassLoader
.
SerializationDelegate
public SerializationDelegate(Serializer<Object> serializer, Deserializer<Object> deserializer)
Create aSerializationDelegate
with the given serializer/deserializer.- 参数:
serializer
- theSerializer
to use (nevernull)
deserializer
- theDeserializer
to use (nevernull)
方法详细资料
serialize
public void serialize(Object object, OutputStream outputStream) throws IOException
从接口复制的说明: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.
- 指定者:
serialize
在接口中Serializer<Object>
- 参数:
object
- the object to serializeoutputStream
- the output stream- 抛出:
IOException
- in case of errors writing to the stream
deserialize
public Object deserialize(InputStream inputStream) throws IOException
从接口复制的说明: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.
- 指定者:
deserialize
在接口中Deserializer<Object>
- 参数:
inputStream
- the input stream- 返回:
- the deserialized object
- 抛出:
IOException
- in case of errors reading from the stream