Class ObjectSerializationEncoder
java.lang.Object
org.apache.mina.filter.codec.ProtocolEncoderAdapter
org.apache.mina.filter.codec.serialization.ObjectSerializationEncoder
- All Implemented Interfaces:
ProtocolEncoder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
encode
(IoSession session, Object message, ProtocolEncoderOutput out) Encodes higher-level message objects into binary or protocol-specific data.int
Returns the allowed maximum size of the encoded object.void
setMaxObjectSize
(int maxObjectSize) Sets the allowed maximum size of the encoded object.Methods inherited from class org.apache.mina.filter.codec.ProtocolEncoderAdapter
dispose
-
Constructor Details
-
ObjectSerializationEncoder
public ObjectSerializationEncoder()Creates a new instance.
-
-
Method Details
-
getMaxObjectSize
public int getMaxObjectSize()Returns the allowed maximum size of the encoded object. If the size of the encoded object exceeds this value, this encoder will throw aIllegalArgumentException
. The default value isInteger.MAX_VALUE
. -
setMaxObjectSize
public void setMaxObjectSize(int maxObjectSize) Sets the allowed maximum size of the encoded object. If the size of the encoded object exceeds this value, this encoder will throw aIllegalArgumentException
. The default value isInteger.MAX_VALUE
. -
encode
Description copied from interface:ProtocolEncoder
Encodes higher-level message objects into binary or protocol-specific data. MINA invokesProtocolEncoder.encode(IoSession, Object, ProtocolEncoderOutput)
method with message which is popped from the session write queue, and then the encoder implementation puts encodedByteBuffer
s intoProtocolEncoderOutput
.- Throws:
Exception
- if the message violated protocol specification
-