Class TextLineEncoder
java.lang.Object
org.apache.mina.filter.codec.ProtocolEncoderAdapter
org.apache.mina.filter.codec.textline.TextLineEncoder
- All Implemented Interfaces:
ProtocolEncoder
A
ProtocolEncoder
which encodes a string into a text line
which ends with the delimiter.-
Constructor Summary
ConstructorsConstructorDescriptionTextLineEncoder
(Charset charset) TextLineEncoder
(Charset charset, LineDelimiter delimiter) TextLineEncoder
(LineDelimiter delimiter) -
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
void
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 line.void
setMaxLineLength
(int maxLineLength) Sets the allowed maximum size of the encoded line.Methods inherited from class org.apache.mina.filter.codec.ProtocolEncoderAdapter
dispose
-
Constructor Details
-
TextLineEncoder
public TextLineEncoder() -
TextLineEncoder
-
TextLineEncoder
-
TextLineEncoder
-
-
Method Details
-
getMaxLineLength
public int getMaxLineLength()Returns the allowed maximum size of the encoded line. If the size of the encoded line exceeds this value, the encoder will throw aIllegalArgumentException
. The default value isInteger.MAX_VALUE
. -
setMaxLineLength
public void setMaxLineLength(int maxLineLength) Sets the allowed maximum size of the encoded line. If the size of the encoded line exceeds this value, the 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
-
dispose
- Throws:
Exception
-