public class TextLineEncoder extends Object implements StatelessProtocolEncoder<String,ByteBuffer>
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(Charset charset)
Creates a new instance with the spcified charset
and
LineDelimiter.UNIX delimiter. |
TextLineEncoder(Charset charset,
LineDelimiter delimiter)
Creates a new instance with the spcified charset
and the specified delimiter.
|
TextLineEncoder(Charset charset,
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(String delimiter)
Creates a new instance with the current default
Charset
and the specified delimiter. |
Modifier and Type | Method and Description |
---|---|
Void |
createEncoderState()
Create a new session context for this decoder
|
ByteBuffer |
encode(String message,
Void context)
Encodes higher-level message objects of type
INPUT into binary or protocol-specific data of type
OUTPUT . |
int |
getMaxLineLength()
Returns the allowed maximum size of the encoded line.
|
void |
setMaxLineLength(int maxLineLength)
Sets the allowed maximum size of the encoded line.
|
public TextLineEncoder()
Charset
and LineDelimiter.UNIX
delimiter.public TextLineEncoder(String delimiter)
Charset
and the specified delimiter.public TextLineEncoder(LineDelimiter delimiter)
Charset
and the specified delimiter.public TextLineEncoder(Charset charset)
LineDelimiter.UNIX
delimiter.public TextLineEncoder(Charset charset, String delimiter)
public TextLineEncoder(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 createEncoderState()
ProtocolEncoder
createEncoderState
in interface ProtocolEncoder<String,ByteBuffer,Void>
public ByteBuffer encode(String message, Void context)
ProtocolEncoder
INPUT
into binary or protocol-specific data of type
OUTPUT
.encode
in interface ProtocolEncoder<String,ByteBuffer,Void>
message
- the message to encodecontext
- the encoding context (will be stored in the session for the next decode call)Copyright © 2009–2013 Apache MINA Project. All rights reserved.