Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.apache.mina.filter.codec.textline.TextLineDecoder
ProtocolDecoder
which decodes a text line into a string.
Constructor Summary | |
| |
| |
|
Method Summary | |
void |
|
void | |
void |
|
int |
|
void |
|
public TextLineDecoder()
Creates a new instance with the current defaultCharset
andLineDelimiter.AUTO
delimiter.
public TextLineDecoder(Charset charset)
Creates a new instance with the spcified charset andLineDelimiter.AUTO
delimiter.
public TextLineDecoder(Charset charset, LineDelimiter delimiter)
Creates a new instance with the specified charset and the specified delimiter.
public void decode(IoSession session, ByteBuffer in, ProtocolDecoderOutput out) throws Exception
Decodes binary or protocol-specific content into higher-level message objects. MINA invokesProtocolDecoder.decode(IoSession,ByteBuffer,ProtocolDecoderOutput)
method with read data, and then the decoder implementation puts decoded messages intoProtocolDecoderOutput
.
- Specified by:
- decode in interface ProtocolDecoder
public void dispose(IoSession session) throws Exception
Releases all resources related with this decoder.
- Specified by:
- dispose in interface ProtocolDecoder
public void finishDecode(IoSession session, ProtocolDecoderOutput out) throws Exception
Invoked when the specified session is closed. This method is useful when you deal with the protocol which doesn't specify the length of a message such as HTTP response without content-length header. Implement this method to process the remaining data thatProtocolDecoder.decode(IoSession,ByteBuffer,ProtocolDecoderOutput)
method didn't process completely.
- Specified by:
- finishDecode in interface ProtocolDecoder
public int getMaxLineLength()
Returns the allowed maximum size of the line to be decoded. If the size of the line to be decoded exceeds this value, the decoder will throw aBufferDataException
. The default value is 1024 (1KB).
public void setMaxLineLength(int maxLineLength)
Sets the allowed maximum size of the line to be decoded. If the size of the line to be decoded exceeds this value, the decoder will throw aBufferDataException
. The default value is 1024 (1KB).