public class IoBufferDecoder extends Object
IoBuffer
decoder which supports
two methods :
- dynamic delimiter decoding
- fixed length content readingModifier and Type | Class and Description |
---|---|
class |
IoBufferDecoder.DecodingContext
The class holding the decoding context.
|
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public IoBufferDecoder(byte[] delimiter)
delimiter
- an array of characters which delimits messagespublic IoBufferDecoder(int contentLength)
contentLength
- the exact length to readpublic void setContentLength(int contentLength, boolean resetMatchCount)
contentLength
- the content length to matchresetMatchCount
- delimiter matching is reset if truepublic void setDelimiter(byte[] delim, boolean resetMatchCount)
decodeFully(IoBuffer)
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 decodeCopyright © 2004–2018 Apache MINA Project. All rights reserved.