Class ObjectSerializationCodecFactory
java.lang.Object
org.apache.mina.filter.codec.serialization.ObjectSerializationCodecFactory
- All Implemented Interfaces:
ProtocolCodecFactory
A
ProtocolCodecFactory
that serializes and deserializes Java objects.
This codec is very useful when you have to prototype your application rapidly
without any specific codec.-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance with theClassLoader
of the current thread.ObjectSerializationCodecFactory
(ClassLoader classLoader) Creates a new instance with the specifiedClassLoader
. -
Method Summary
Modifier and TypeMethodDescriptionReturns a new (or reusable) instance ofProtocolDecoder
which decodes binary or protocol-specific data into message objects.int
Returns the allowed maximum size of the object to be decoded.Returns a new (or reusable) instance ofProtocolEncoder
which encodes message objects into binary or protocol-specific data.int
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.
-
Constructor Details
-
ObjectSerializationCodecFactory
public ObjectSerializationCodecFactory()Creates a new instance with theClassLoader
of the current thread. -
ObjectSerializationCodecFactory
Creates a new instance with the specifiedClassLoader
.
-
-
Method Details
-
getEncoder
Description copied from interface:ProtocolCodecFactory
Returns a new (or reusable) instance ofProtocolEncoder
which encodes message objects into binary or protocol-specific data.- Specified by:
getEncoder
in interfaceProtocolCodecFactory
-
getDecoder
Description copied from interface:ProtocolCodecFactory
Returns a new (or reusable) instance ofProtocolDecoder
which decodes binary or protocol-specific data into message objects.- Specified by:
getDecoder
in interfaceProtocolCodecFactory
-
getEncoderMaxObjectSize
public int getEncoderMaxObjectSize()Returns the allowed maximum size of the encoded object. If the size of the encoded object exceeds this value, the encoder will throw aIllegalArgumentException
. The default value isInteger.MAX_VALUE
.This method does the same job with
ObjectSerializationEncoder.getMaxObjectSize()
. -
setEncoderMaxObjectSize
public void setEncoderMaxObjectSize(int maxObjectSize) Sets the allowed maximum size of the encoded object. If the size of the encoded object exceeds this value, the encoder will throw aIllegalArgumentException
. The default value isInteger.MAX_VALUE
.This method does the same job with
ObjectSerializationEncoder.setMaxObjectSize(int)
. -
getDecoderMaxObjectSize
public int getDecoderMaxObjectSize()Returns the allowed maximum size of the object to be decoded. If the size of the object to be decoded exceeds this value, the decoder will throw aBufferDataException
. The default value is 1048576 (1MB).This method does the same job with
ObjectSerializationDecoder.getMaxObjectSize()
. -
setDecoderMaxObjectSize
public void setDecoderMaxObjectSize(int maxObjectSize) Sets the allowed maximum size of the object to be decoded. If the size of the object to be decoded exceeds this value, the decoder will throw aBufferDataException
. The default value is 1048576 (1MB).This method does the same job with
ObjectSerializationDecoder.setMaxObjectSize(int)
.
-