|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.simpleframework.transport.TransportCursor
public class TransportCursor
The TransportCursor object represents a cursor that
can read and buffer data from an underlying transport. If the
number of bytes read from the cursor is more than required for
the HTTP request then those bytes can be pushed back in to the
cursor using the reset method. This will only allow
the last read to be reset within the cursor safely.
Transport| Constructor Summary | |
|---|---|
TransportCursor(Transport transport)
Constructor for the TransportCursor object. |
|
TransportCursor(Transport transport,
int size)
Constructor for the TransportCursor object. |
|
| 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 size)
Moves the cursor backward within the stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TransportCursor(Transport transport)
TransportCursor object. This
requires a transport to read the bytes from. By default this
will create a buffer of of the specified size to read the
input in to which enabled bytes to be buffered internally.
transport - this is the underlying transport to use
public TransportCursor(Transport transport,
int size)
TransportCursor object. This
requires a transport to read the bytes from. By default this
will create a buffer of of the specified size to read the
input in to which enabled bytes to be buffered internally.
transport - this is the underlying transport to usesize - this is the size of the internal buffer to use| Method Detail |
|---|
public boolean isOpen()
throws IOException
isOpen in interface ByteCursorIOException
public boolean isReady()
throws IOException
isReady in interface ByteCursorIOException
public int ready()
throws IOException
ready in interface ByteCursorIOException
public int read(byte[] data)
throws IOException
read in interface ByteCursordata - this is the array to read the bytes in to
IOException
public int read(byte[] data,
int off,
int len)
throws IOException
read in interface ByteCursordata - 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
IOException
public void push(byte[] data)
throws IOException
reset method which will reset
the cursors position on a stream. Allowing data to be pushed
on to the cursor allows more flexibility.
push in interface ByteCursordata - this is the data to be pushed on to the cursor
IOException
public void push(byte[] data,
int off,
int len)
throws IOException
reset method which will reset
the cursors position on a stream. Allowing data to be pushed
on to the cursor allows more flexibility.
push in interface ByteCursordata - 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
IOException
public int reset(int size)
throws IOException
reset in interface ByteCursorsize - this is the number of bytes to reset back
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||