|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface SessionInputBuffer
Session input buffer for non-blocking connections. This interface facilitates
intermediate buffering of input data streamed from a source channel and
reading buffered data to a destination, usually ByteBuffer
or
WritableByteChannel
. This interface also provides methods for reading
lines of text.
Method Summary | |
---|---|
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. |
String |
readLine(boolean endOfStream)
Attempts to transfer a complete line of characters up to a line delimiter from this buffer to a newly created string. |
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. |
Method Detail |
---|
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 CharacterCodingException
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 flag
true
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.String readLine(boolean endOfStream) throws CharacterCodingException
null
. 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.
endOfStream
- end of stream flag
null
otherwise.
CharacterCodingException
- in case a character encoding or decoding
error occurs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |