public class TextLineCodecFactory extends Object implements ProtocolCodecFactory
ProtocolCodecFactory
that performs encoding and decoding between
a text line data and a Java string object. This codec is useful especially
when you work with a text-based protocols such as SMTP and IMAP.Constructor and Description |
---|
TextLineCodecFactory()
Creates a new instance with the current default
Charset . |
TextLineCodecFactory(Charset charset)
Creates a new instance with the specified
Charset . |
TextLineCodecFactory(Charset charset,
LineDelimiter encodingDelimiter,
LineDelimiter decodingDelimiter)
Creates a new instance of TextLineCodecFactory.
|
TextLineCodecFactory(Charset charset,
String encodingDelimiter,
String decodingDelimiter)
Creates a new instance of TextLineCodecFactory.
|
Modifier and Type | Method and Description |
---|---|
ProtocolDecoder |
getDecoder(IoSession session)
Returns a new (or reusable) instance of
ProtocolDecoder which
decodes binary or protocol-specific data into message objects. |
int |
getDecoderMaxLineLength() |
ProtocolEncoder |
getEncoder(IoSession session)
Returns a new (or reusable) instance of
ProtocolEncoder which
encodes message objects into binary or protocol-specific data. |
int |
getEncoderMaxLineLength() |
void |
setDecoderMaxLineLength(int maxLineLength)
Sets the allowed maximum size of the line to be decoded.
|
void |
setEncoderMaxLineLength(int maxLineLength)
Sets the allowed maximum size of the encoded line.
|
public TextLineCodecFactory()
Charset
.public TextLineCodecFactory(Charset charset)
Charset
. The
encoder uses a UNIX LineDelimiter
and the decoder uses
the AUTO LineDelimiter
.charset
- The charset to use in the encoding and decodingpublic TextLineCodecFactory(Charset charset, String encodingDelimiter, String decodingDelimiter)
charset
- The charset to use in the encoding and decodingencodingDelimiter
- The line delimeter for the encoderdecodingDelimiter
- The line delimeter for the decoderpublic TextLineCodecFactory(Charset charset, LineDelimiter encodingDelimiter, LineDelimiter decodingDelimiter)
charset
- The charset to use in the encoding and decodingencodingDelimiter
- The line delimeter for the encoderdecodingDelimiter
- The line delimeter for the decoderpublic ProtocolEncoder getEncoder(IoSession session)
ProtocolEncoder
which
encodes message objects into binary or protocol-specific data.getEncoder
in interface ProtocolCodecFactory
session
- The current sessionpublic ProtocolDecoder getDecoder(IoSession session)
ProtocolDecoder
which
decodes binary or protocol-specific data into message objects.getDecoder
in interface ProtocolCodecFactory
session
- The current sessionpublic int getEncoderMaxLineLength()
IllegalArgumentException
. The default value
is Integer.MAX_VALUE
.
This method does the same job with TextLineEncoder.getMaxLineLength()
.
public void setEncoderMaxLineLength(int maxLineLength)
IllegalArgumentException
. The default value
is Integer.MAX_VALUE
.
This method does the same job with TextLineEncoder.setMaxLineLength(int)
.
maxLineLength
- The maximum encoded line lengthpublic int getDecoderMaxLineLength()
BufferDataException
. The default
value is 1024 (1KB).
This method does the same job with TextLineDecoder.getMaxLineLength()
.
public void setDecoderMaxLineLength(int maxLineLength)
BufferDataException
. The default
value is 1024 (1KB).
This method does the same job with TextLineDecoder.setMaxLineLength(int)
.
maxLineLength
- the maximum decoded line lengthCopyright © 2004–2021 Apache MINA Project. All rights reserved.