Class ObjectSerializationEncoder
- java.lang.Object
-
- org.apache.mina.filter.codec.ProtocolEncoderAdapter
-
- org.apache.mina.filter.codec.serialization.ObjectSerializationEncoder
-
- All Implemented Interfaces:
ProtocolEncoder
public class ObjectSerializationEncoder extends ProtocolEncoderAdapter
- Author:
- Apache MINA Project
-
-
Constructor Summary
Constructors Constructor Description ObjectSerializationEncoder()Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidencode(IoSession session, Object message, ProtocolEncoderOutput out)Encodes higher-level message objects into binary or protocol-specific data.intgetMaxObjectSize()voidsetMaxObjectSize(int maxObjectSize)Sets the allowed maximum size of the encoded object.-
Methods inherited from class org.apache.mina.filter.codec.ProtocolEncoderAdapter
dispose
-
-
-
-
Method Detail
-
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 a
IllegalArgumentException. 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.- Parameters:
maxObjectSize- the maximum size for an encoded object
-
encode
public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws Exception
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 encoded messages (typicallyIoBuffers) intoProtocolEncoderOutput.- Parameters:
session- The current Sessionmessage- the message to encodeout- TheProtocolEncoderOutputthat will receive the encoded message- Throws:
Exception- if the message violated protocol specification
-
-