|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Cursor
The Cursor
object is used to acquire bytes from a
given source. This provides a cursor style reading of bytes from
a stream in that it will allow the reader to move the cursor back
if the amount of bytes read is too much. Allowing the cursor to
move ensures that excess bytes back be placed back in the stream.
This is used when parsing input from a stream as it ensures that on arrival at a terminal token any excess bytes can be placed back in to the stream. This allows data to be read efficiently in large chunks from blocking streams such as sockets.
TransportCursor
Method Summary | |
---|---|
boolean |
isOpen()
Determines whether the cursor is still open. |
boolean |
isReady()
Determines whether the cursor is ready for reading. |
void |
push(byte[] data)
Pushes the provided data on to the cursor. |
void |
push(byte[] data,
int off,
int len)
Pushes the provided data on to the cursor. |
int |
read(byte[] data)
Reads a block of bytes from the underlying stream. |
int |
read(byte[] data,
int off,
int len)
Reads a block of bytes from the underlying stream. |
int |
ready()
Provides the number of bytes that can be read from the stream without blocking. |
int |
reset(int len)
Moves the cursor backward within the stream. |
Method Detail |
---|
boolean isOpen() throws java.io.IOException
java.io.IOException
boolean isReady() throws java.io.IOException
java.io.IOException
int ready() throws java.io.IOException
java.io.IOException
int read(byte[] data) throws java.io.IOException
data
- this is the array to read the bytes in to
java.io.IOException
int read(byte[] data, int off, int len) throws java.io.IOException
data
- this is the array to read the bytes in tooff
- this is the offset to begin writing the bytes tolen
- this is the number of bytes that are requested
java.io.IOException
void push(byte[] data) throws java.io.IOException
reset
method which will reset
the cursors position on a stream. Allowing data to be pushed
on to the cursor allows more flexibility.
data
- this is the data to be pushed on to the cursor
java.io.IOException
void push(byte[] data, int off, int len) throws java.io.IOException
reset
method which will reset
the cursors position on a stream. Allowing data to be pushed
on to the cursor allows more flexibility.
data
- this is the data to be pushed on to the cursoroff
- this is the offset to begin reading the byteslen
- this is the number of bytes that are to be used
java.io.IOException
int reset(int len) throws java.io.IOException
len
- this is the number of bytes to reset back
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |