Class ObjectSerializationEncoder
java.lang.Object
org.apache.mina.filter.codec.ProtocolEncoderAdapter
org.apache.mina.filter.codec.serialization.ObjectSerializationEncoder
- All Implemented Interfaces:
ProtocolEncoder
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidencode(IoSession session, Object message, ProtocolEncoderOutput out) Encodes higher-level message objects into binary or protocol-specific data.intvoidsetMaxObjectSize(int maxObjectSize) Sets the allowed maximum size of the encoded object.Methods inherited from class ProtocolEncoderAdapter
dispose
-
Field Details
-
maxObjectSize
private int maxObjectSize
-
-
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 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
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
-