|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.mina.proxy.utils.IoBufferDecoder
public class IoBufferDecoder
IoBufferDecoder.java - Handles an IoBuffer
decoder which supports
two methods :
- dynamic delimiter decoding
- fixed length content reading
Nested Class Summary | |
---|---|
class |
IoBufferDecoder.DecodingContext
The class holding the decoding context. |
Constructor Summary | |
---|---|
IoBufferDecoder(byte[] delimiter)
Creates a new instance that uses specified delimiter byte array as a message delimiter. |
|
IoBufferDecoder(int contentLength)
Creates a new instance that will read messages of contentLength bytes. |
Method Summary | |
---|---|
IoBuffer |
decodeFully(IoBuffer in)
Will return null unless it has enough data to decode. |
void |
setContentLength(int contentLength,
boolean resetMatchCount)
Sets the the length of the content line to be decoded. |
void |
setDelimiter(byte[] delim,
boolean resetMatchCount)
Dynamically sets a new delimiter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IoBufferDecoder(byte[] delimiter)
delimiter
- an array of characters which delimits messagespublic IoBufferDecoder(int contentLength)
contentLength
- the exact length to readMethod Detail |
---|
public void setContentLength(int contentLength, boolean resetMatchCount)
contentLength
- the content length to matchresetMatchCount
- delimiter matching is reset if truepublic void setDelimiter(byte[] delim, boolean resetMatchCount)
IoBufferDecoder#decodeOnce(IoSession, int)
will be called it will use the new
delimiter. Delimiter matching is reset only if resetMatchCount is true but
decoding will continue from current position.
NB : Delimiter LineDelimiter.AUTO
is not allowed.
delim
- the new delimiter as a byte arrayresetMatchCount
- delimiter matching is reset if truepublic IoBuffer decodeFully(IoBuffer in)
contentLength
is set then it tries to retrieve contentLength
bytes from the buffer
otherwise it will scan the buffer to find the data delimiter
and return
all the data and the trailing delimiter.
in
- the data to decode
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |