ProtocolEncoder
public class TextLineEncoder extends ProtocolEncoderAdapter
ProtocolEncoder
which encodes a string into a text line
which ends with the delimiter.Constructor | Description |
---|---|
TextLineEncoder() |
|
TextLineEncoder(java.nio.charset.Charset charset) |
|
TextLineEncoder(java.nio.charset.Charset charset,
LineDelimiter delimiter) |
|
TextLineEncoder(LineDelimiter delimiter) |
Modifier and Type | Method | 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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
dispose
public TextLineEncoder()
public TextLineEncoder(LineDelimiter delimiter)
public TextLineEncoder(java.nio.charset.Charset charset)
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 ByteBuffer
s into
ProtocolEncoderOutput
.java.lang.Exception
- if the message violated protocol specificationpublic void dispose() throws java.lang.Exception
java.lang.Exception