public class TextLineEncoder extends ProtocolEncoderAdapter
ProtocolEncoder
which encodes a string into a text line
which ends with the delimiter.Constructor and Description |
---|
TextLineEncoder()
Creates a new instance with the current default
Charset
and LineDelimiter.UNIX delimiter. |
TextLineEncoder(java.nio.charset.Charset charset)
Creates a new instance with the spcified charset
and
LineDelimiter.UNIX delimiter. |
TextLineEncoder(java.nio.charset.Charset charset,
LineDelimiter delimiter)
Creates a new instance with the spcified charset
and the specified delimiter.
|
TextLineEncoder(java.nio.charset.Charset charset,
java.lang.String delimiter)
Creates a new instance with the spcified charset
and the specified delimiter.
|
TextLineEncoder(LineDelimiter delimiter)
Creates a new instance with the current default
Charset
and the specified delimiter. |
TextLineEncoder(java.lang.String delimiter)
Creates a new instance with the current default
Charset
and the specified delimiter. |
Modifier and Type | Method and Description |
---|---|
void |
dispose() |
void |
encode(IoSession session,
java.lang.Object message,
ProtocolEncoderOutput out)
Encodes higher-level message objects into binary or protocol-specific data.
|
int |
getMaxLineLength()
Returns the allowed maximum size of the encoded line.
|
void |
setMaxLineLength(int maxLineLength)
Sets the allowed maximum size of the encoded line.
|
dispose
public TextLineEncoder()
Charset
and LineDelimiter.UNIX
delimiter.public TextLineEncoder(java.lang.String delimiter)
Charset
and the specified delimiter.public TextLineEncoder(LineDelimiter delimiter)
Charset
and the specified delimiter.public TextLineEncoder(java.nio.charset.Charset charset)
LineDelimiter.UNIX
delimiter.public TextLineEncoder(java.nio.charset.Charset charset, java.lang.String delimiter)
public TextLineEncoder(java.nio.charset.Charset charset, LineDelimiter delimiter)
public int getMaxLineLength()
IllegalArgumentException
. The default value
is Integer.MAX_VALUE
.public void setMaxLineLength(int maxLineLength)
IllegalArgumentException
. The default value
is Integer.MAX_VALUE
.public void encode(IoSession session, java.lang.Object message, ProtocolEncoderOutput out) throws java.lang.Exception
ProtocolEncoder
ProtocolEncoder.encode(IoSession, Object, ProtocolEncoderOutput)
method with message which is popped from the session write queue, and then
the encoder implementation puts encoded messages (typically IoBuffer
s)
into ProtocolEncoderOutput
.java.lang.Exception
- if the message violated protocol specificationpublic void dispose() throws java.lang.Exception
java.lang.Exception
Copyright © 2004-2019 Apache MINA Project. All Rights Reserved.