|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.mina.filter.codec.textline.TextLineDecoder
public class TextLineDecoder
A ProtocolDecoder
which decodes a text line into a string.
Constructor Summary | |
---|---|
TextLineDecoder()
Creates a new instance with the current default Charset
and LineDelimiter.AUTO delimiter. |
|
TextLineDecoder(Charset charset)
Creates a new instance with the spcified charset and LineDelimiter.AUTO delimiter. |
|
TextLineDecoder(Charset charset,
LineDelimiter delimiter)
Creates a new instance with the specified charset and the specified delimiter. |
|
TextLineDecoder(Charset charset,
String delimiter)
Creates a new instance with the spcified charset and the specified delimiter. |
|
TextLineDecoder(LineDelimiter delimiter)
Creates a new instance with the current default Charset
and the specified delimiter. |
|
TextLineDecoder(String delimiter)
Creates a new instance with the current default Charset
and the specified delimiter. |
Method Summary | |
---|---|
void |
decode(IoSession session,
IoBuffer in,
ProtocolDecoderOutput out)
Decodes binary or protocol-specific content into higher-level message objects. |
void |
dispose(IoSession session)
Releases all resources related with this decoder. |
void |
finishDecode(IoSession session,
ProtocolDecoderOutput out)
Invoked when the specified session is closed. |
int |
getBufferLength()
Returns the allowed buffer size used to store the decoded line in the Context instance. |
int |
getMaxLineLength()
Returns the allowed maximum size of the line to be decoded. |
void |
setBufferLength(int bufferLength)
Sets the default buffer size. |
void |
setMaxLineLength(int maxLineLength)
Sets the allowed maximum size of the line to be decoded. |
protected void |
writeText(IoSession session,
String text,
ProtocolDecoderOutput out)
By default, this method propagates the decoded line of text to ProtocolDecoderOutput#write(Object) . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TextLineDecoder()
Charset
and LineDelimiter.AUTO
delimiter.
public TextLineDecoder(String delimiter)
Charset
and the specified delimiter.
public TextLineDecoder(LineDelimiter delimiter)
Charset
and the specified delimiter.
public TextLineDecoder(Charset charset)
LineDelimiter.AUTO
delimiter.
public TextLineDecoder(Charset charset, String delimiter)
public TextLineDecoder(Charset charset, LineDelimiter delimiter)
Method Detail |
---|
public int getMaxLineLength()
BufferDataException
. The default
value is 1024 (1KB).
public void setMaxLineLength(int maxLineLength)
BufferDataException
. The default
value is 1024 (1KB).
public void setBufferLength(int bufferLength)
bufferLength
- The default bufer sizepublic int getBufferLength()
public void decode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception
ProtocolDecoder.decode(IoSession, IoBuffer, ProtocolDecoderOutput)
method with read data, and then the decoder implementation puts decoded
messages into ProtocolDecoderOutput
.
decode
in interface ProtocolDecoder
Exception
- if the read data violated protocol specificationpublic void finishDecode(IoSession session, ProtocolDecoderOutput out) throws Exception
ProtocolDecoder.decode(IoSession, IoBuffer, ProtocolDecoderOutput)
method didn't process completely.
finishDecode
in interface ProtocolDecoder
Exception
- if the read data violated protocol specificationpublic void dispose(IoSession session) throws Exception
dispose
in interface ProtocolDecoder
Exception
- if failed to dispose all resourcesprotected void writeText(IoSession session, String text, ProtocolDecoderOutput out)
ProtocolDecoderOutput#write(Object)
. You may override this method to modify
the default behavior.
session
- the IoSession
the received data.text
- the decoded textout
- the upstream ProtocolDecoderOutput
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |