public class ObjectSerializationCodecFactory extends java.lang.Object implements ProtocolCodecFactory
ProtocolCodecFactory
that serializes and deserializes Java objects.
This codec is very useful when you have to prototype your application rapidly
without any specific codec.构造器和说明 |
---|
ObjectSerializationCodecFactory()
Creates a new instance with the
ClassLoader of
the current thread. |
ObjectSerializationCodecFactory(java.lang.ClassLoader classLoader)
Creates a new instance with the specified
ClassLoader . |
限定符和类型 | 方法和说明 |
---|---|
ProtocolDecoder |
getDecoder()
Returns a new (or reusable) instance of
ProtocolDecoder which
decodes binary or protocol-specific data into message objects. |
int |
getDecoderMaxObjectSize()
Returns the allowed maximum size of the object to be decoded.
|
ProtocolEncoder |
getEncoder()
Returns a new (or reusable) instance of
ProtocolEncoder which
encodes message objects into binary or protocol-specific data. |
int |
getEncoderMaxObjectSize()
Returns the allowed maximum size of the encoded object.
|
void |
setDecoderMaxObjectSize(int maxObjectSize)
Sets the allowed maximum size of the object to be decoded.
|
void |
setEncoderMaxObjectSize(int maxObjectSize)
Sets the allowed maximum size of the encoded object.
|
public ObjectSerializationCodecFactory()
ClassLoader
of
the current thread.public ObjectSerializationCodecFactory(java.lang.ClassLoader classLoader)
ClassLoader
.public ProtocolEncoder getEncoder()
ProtocolCodecFactory
ProtocolEncoder
which
encodes message objects into binary or protocol-specific data.getEncoder
在接口中 ProtocolCodecFactory
public ProtocolDecoder getDecoder()
ProtocolCodecFactory
ProtocolDecoder
which
decodes binary or protocol-specific data into message objects.getDecoder
在接口中 ProtocolCodecFactory
public int getEncoderMaxObjectSize()
IllegalArgumentException
. The default value
is Integer.MAX_VALUE
.
This method does the same job with ObjectSerializationEncoder.getMaxObjectSize()
.
public void setEncoderMaxObjectSize(int maxObjectSize)
IllegalArgumentException
. The default value
is Integer.MAX_VALUE
.
This method does the same job with ObjectSerializationEncoder.setMaxObjectSize(int)
.
public int getDecoderMaxObjectSize()
BufferDataException
. The default
value is 1048576 (1MB).
This method does the same job with ObjectSerializationDecoder.getMaxObjectSize()
.
public void setDecoderMaxObjectSize(int maxObjectSize)
BufferDataException
. The default
value is 1048576 (1MB).
This method does the same job with ObjectSerializationDecoder.setMaxObjectSize(int)
.