|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface StreamReader
Interface that defines methods for reading primitive types and arrays
of primitive types from a stream. A stream is implemented as a sequence
of Buffers which are supplied by the receiveData method.
The stream consumes the Buffers: after all data has been read from
a Buffer, Buffer.dispose() is called.
Note, that StreamReader implementation may not be thread-safe.
StreamWriter,
Connection| Method Summary | |
|---|---|
boolean |
appendBuffer(Buffer buffer)
Add more data to the end of the stream. |
int |
availableDataSize()
Return the number of bytes available for get calls. |
void |
finishBuffer()
Finishes processing of the current StreamReader's source Buffer. |
Buffer |
getBuffer()
Return the current StreamReader's source Buffer. |
int |
getBufferSize()
Get the preferred Buffer size to be used for StreamReader
read operations. |
Connection |
getConnection()
Get the Connection this StreamReader belongs to. |
long |
getTimeout(TimeUnit timeunit)
Get the timeout for StreamReader I/O operations. |
boolean |
isBlocking()
Returns the StreamReader mode. |
boolean |
isClosed()
Returns true, if StreamReader has been closed, or false otherwise. |
Future<Integer> |
notifyAvailable(int size)
Method returns Future, using which it's possible check if
StreamReader has required amound of bytes available
for reading reading. |
Future<Integer> |
notifyAvailable(int size,
CompletionHandler<Integer> completionHandler)
Method returns Future, using which it's possible check if
StreamReader has required amound of bytes available
for reading reading. |
Future<Integer> |
notifyCondition(Condition<StreamReader> condition)
Method returns Future, using which it's possible check if
StreamReader meets specific Condition. |
Future<Integer> |
notifyCondition(Condition<StreamReader> condition,
CompletionHandler<Integer> completionHandler)
Method returns Future, using which it's possible check if
StreamReader meets specific Condition. |
boolean |
prependBuffer(Buffer buffer)
Add more data to the beginning of the stream. |
boolean |
readBoolean()
Get the next boolean in the stream. |
void |
readBooleanArray(boolean[] data)
Fill data with booleans (byte 1=true, 0=false) from the stream. |
Buffer |
readBuffer()
Returns the current StreamReader's source Buffer and
makes next available Buffer current. |
byte |
readByte()
Get the next byte in the stream. |
void |
readByteArray(byte[] data)
Fill data with bytes from the stream. |
void |
readByteArray(byte[] data,
int offset,
int length)
Fill data with bytes from the stream. |
void |
readBytes(Buffer buffer)
Fill the buffer with data from the stream (that is, copy data from the stream to fill buffer from position to limit). |
char |
readChar()
Get the next character in the stream. |
void |
readCharArray(char[] data)
Fill data with characters from the stream. |
double |
readDouble()
Get the next double in the stream. |
void |
readDoubleArray(double[] data)
Fill data with characters from the stream. |
float |
readFloat()
Get the next float in the stream. |
void |
readFloatArray(float[] data)
Fill data with characters from the stream. |
int |
readInt()
Get the next int in the stream. |
void |
readIntArray(int[] data)
Fill data with characters from the stream. |
long |
readLong()
Get the next long in the stream. |
void |
readLongArray(long[] data)
Fill data with characters from the stream. |
short |
readShort()
Get the next short in the stream. |
void |
readShortArray(short[] data)
Fill data with characters from the stream. |
void |
setBlocking(boolean isBlocking)
Sets the StreamReader mode. |
void |
setBufferSize(int size)
Set the preferred Buffer size to be used for StreamReader
read operations. |
void |
setTimeout(long timeout,
TimeUnit timeunit)
Set the timeout for StreamReader I/O operations. |
| Methods inherited from interface java.io.Closeable |
|---|
close |
| Method Detail |
|---|
boolean isBlocking()
StreamReader mode.
true, if StreamReader is operating in blocking mode, or
false otherwise.
StreamReader mode.void setBlocking(boolean isBlocking)
StreamReader mode.
isBlocking - true, if StreamReader is operating in
blocking mode, or false otherwise.Future<Integer> notifyAvailable(int size)
Future, using which it's possible check if
StreamReader has required amound of bytes available
for reading reading.
size - number of bytes, which should become available on
StreamReader.
Future, using which it's possible to check whether
StreamReader has required amount of bytes available for reading.
Future<Integer> notifyAvailable(int size,
CompletionHandler<Integer> completionHandler)
Future, using which it's possible check if
StreamReader has required amound of bytes available
for reading reading.
CompletionHandler is also passed to get notified, once required
number of bytes will become available for reading.
size - number of bytes, which should become available on
StreamReader.completionHandler - CompletionHandler, which will be notified
once required number of bytes will become available.
Future, using which it's possible to check whether
StreamReader has required amount of bytes available for reading.Future<Integer> notifyCondition(Condition<StreamReader> condition)
Future, using which it's possible check if
StreamReader meets specific Condition.
condition - Condition StreamReader should meet.
Future, using which it's possible to check whether
StreamReader meets the required Condition.
Future<Integer> notifyCondition(Condition<StreamReader> condition,
CompletionHandler<Integer> completionHandler)
Future, using which it's possible check if
StreamReader meets specific Condition.
CompletionHandler is also passed to get notified, once
the Condition will be satisfied.
condition - Condition StreamReader should meet.completionHandler - CompletionHandler, which will be
notified, once the Condition will be satisfied.
Future, using which it's possible to check whether
StreamReader meets the required Condition.boolean prependBuffer(Buffer buffer)
StreamReader,
or false otherwiseboolean appendBuffer(Buffer buffer)
StreamReader,
or false otherwiseint availableDataSize()
boolean readBoolean()
throws IOException
IOException
byte readByte()
throws IOException
IOException
char readChar()
throws IOException
IOException
short readShort()
throws IOException
IOException
int readInt()
throws IOException
IOException
long readLong()
throws IOException
IOException
float readFloat()
throws IOException
IOException
double readDouble()
throws IOException
IOException
void readBooleanArray(boolean[] data)
throws IOException
IOException
void readByteArray(byte[] data)
throws IOException
IOException
void readByteArray(byte[] data,
int offset,
int length)
throws IOException
IOException
void readBytes(Buffer buffer)
throws IOException
IOException
void readCharArray(char[] data)
throws IOException
IOException
void readShortArray(short[] data)
throws IOException
IOException
void readIntArray(int[] data)
throws IOException
IOException
void readLongArray(long[] data)
throws IOException
IOException
void readFloatArray(float[] data)
throws IOException
IOException
void readDoubleArray(double[] data)
throws IOException
IOExceptionboolean isClosed()
Buffer readBuffer()
throws IOException
Buffer and
makes next available Buffer current.
Buffer
IOExceptionBuffer getBuffer()
Buffer.
Unlike readBuffer(), this method doesn't
make any internal updates of current Buffer.
Buffer.void finishBuffer()
Buffer. This method doesn't call Buffer.dispose().
Connection getConnection()
Connection this StreamReader belongs to.
Connection this StreamReader belongs to.int getBufferSize()
Buffer size to be used for StreamReader
read operations.
Buffer size to be used for StreamReader
read operations.void setBufferSize(int size)
Buffer size to be used for StreamReader
read operations.
size - the preferred Buffer size to be used for
StreamReader read operations.long getTimeout(TimeUnit timeunit)
timeunit - timeout unit TimeUnit.
void setTimeout(long timeout,
TimeUnit timeunit)
timeout - the timeout for StreamReader I/O operations.timeunit - timeout unit TimeUnit.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||