|
|||||||||
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 usepublic 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 useMethod Detail |
---|
public boolean isOpen() throws java.io.IOException
isOpen
in interface Cursor
java.io.IOException
public boolean isReady() throws java.io.IOException
isReady
in interface Cursor
java.io.IOException
public int ready() throws java.io.IOException
ready
in interface Cursor
java.io.IOException
public int read(byte[] data) throws java.io.IOException
read
in interface Cursor
data
- this is the array to read the bytes in to
java.io.IOException
public int read(byte[] data, int off, int len) throws java.io.IOException
read
in interface Cursor
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
public 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.
push
in interface Cursor
data
- this is the data to be pushed on to the cursor
java.io.IOException
public 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.
push
in interface Cursor
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
public int reset(int size) throws java.io.IOException
reset
in interface Cursor
size
- 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 |