public interface StreamReader extends Stream
Buffer
s which are supplied by the receiveData method.
The stream consumes the Buffer
s: after all data has been read from
a Buffer
, Buffer.dispose()
is called.
Note, that StreamReader implementation may not be thread-safe.StreamWriter
,
Connection
Modifier and Type | Method and Description |
---|---|
int |
available()
Return the number of bytes available for get calls.
|
<E> GrizzlyFuture<E> |
decode(Transformer<Stream,E> decoder)
Read and decode data from the StreamReader
|
<E> GrizzlyFuture<E> |
decode(Transformer<Stream,E> decoder,
CompletionHandler<E> completionHandler)
Read and decode data from the StreamReader
|
Buffer |
getBufferWindow() |
boolean |
hasAvailable()
Return true if StreamReader has available data, which
could be read, or false otherwise.
|
boolean |
isClosed()
Returns true, if StreamReader has been closed,
or false otherwise.
|
boolean |
isSupportBufferWindow() |
GrizzlyFuture<Integer> |
notifyAvailable(int size)
Method returns
Future , using which it's possible check if
StreamReader has required amount of bytes available
for reading reading. |
GrizzlyFuture<Integer> |
notifyAvailable(int size,
CompletionHandler<Integer> completionHandler)
Method returns
Future , using which it's possible check if
StreamReader has required amount of bytes available
for reading reading. |
GrizzlyFuture<Integer> |
notifyCondition(Condition condition)
|
GrizzlyFuture<Integer> |
notifyCondition(Condition condition,
CompletionHandler<Integer> completionHandler)
|
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.
|
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 |
skip(int length) |
Buffer |
takeBufferWindow() |
getConnection
GrizzlyFuture<Integer> notifyAvailable(int size)
Future
, using which it's possible check if
StreamReader has required amount 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.GrizzlyFuture<Integer> notifyAvailable(int size, CompletionHandler<Integer> completionHandler)
Future
, using which it's possible check if
StreamReader has required amount 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.GrizzlyFuture<Integer> notifyCondition(Condition condition)
GrizzlyFuture<Integer> notifyCondition(Condition 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 hasAvailable()
int available()
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
IOException
void skip(int length)
<E> GrizzlyFuture<E> decode(Transformer<Stream,E> decoder)
E
- decoded data typedecoder
- Transformer
Future
, which will hold the decoding state.<E> GrizzlyFuture<E> decode(Transformer<Stream,E> decoder, CompletionHandler<E> completionHandler)
E
- decoded data typedecoder
- Transformer
completionHandler
- CompletionHandler
, which will be
notified, when decoder will become ready.Future
, which will hold the decoding state.boolean isClosed()
boolean isSupportBufferWindow()
Buffer getBufferWindow()
Buffer takeBufferWindow()
Copyright © 2015 Oracle Corporation. All rights reserved.