public interface SessionInputBuffer
This interface facilitates intermediate buffering of input data streamed from a source channel and provides methods for reading lines of text.
| Modifier and Type | Method and Description |
|---|---|
int |
fill(ReadableByteChannel src)
Makes an attempt to fill the buffer with data from the given
ReadableByteChannel. |
boolean |
hasData()
Determines if the buffer contains data.
|
int |
length()
Returns the length of this buffer.
|
int |
read()
Reads one byte from the buffer.
|
int |
read(ByteBuffer dst)
Reads a sequence of bytes from this buffer into the destination buffer.
|
int |
read(ByteBuffer dst,
int maxLen)
Reads a sequence of bytes from this buffer into the destination buffer,
up to the given maximum limit.
|
int |
read(WritableByteChannel dst)
Reads a sequence of bytes from this buffer into the destination channel.
|
int |
read(WritableByteChannel dst,
int maxLen)
Reads a sequence of bytes from this buffer into the destination channel,
up to the given maximum limit.
|
boolean |
readLine(CharArrayBuffer dst,
boolean endOfStream)
Attempts to transfer a complete line of characters up to a line delimiter
from this buffer to the destination buffer.
|
boolean hasData()
true if there is data in the buffer,
false otherwise.int length()
int fill(ReadableByteChannel src) throws IOException
ReadableByteChannel.src - the source channel-1 if the
channel has reached end-of-stream.IOException - in case of an I/O error.int read()
int read(ByteBuffer dst, int maxLen)
maxLen value.dst - the destination buffer.maxLen - the maximum number of bytes to be read.int read(ByteBuffer dst)
dst - the destination buffer.int read(WritableByteChannel dst, int maxLen) throws IOException
maxLen value.dst - the destination channel.maxLen - the maximum number of bytes to be read.IOException - in case of an I/O error.int read(WritableByteChannel dst) throws IOException
dst - the destination channel.IOException - in case of an I/O error.boolean readLine(CharArrayBuffer dst, boolean endOfStream) throws IOException
true. The line
delimiter itself is discarded. If a complete line is not available in
the buffer, this method returns false without transferring
anything to the destination buffer. If endOfStream parameter
is set to true this method assumes the end of stream has
been reached and the content currently stored in the buffer should be
treated as a complete line.
The choice of a char encoding and line delimiter sequence is up to the specific implementations of this interface.
dst - the destination buffer.endOfStream - end of stream flagtrue if a sequence of chars representing a complete
line has been transferred to the destination buffer, false
otherwise.CharacterCodingException - in case a character encoding or decoding
error occurs.MessageConstraintException - in case a message constraint violation.IOExceptionCopyright © 2005–2021 The Apache Software Foundation. All rights reserved.