public interface StreamReader extends Stream
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| 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() |
getConnectionGrizzlyFuture<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
IOExceptionbyte readByte()
throws IOException
IOExceptionchar readChar()
throws IOException
IOExceptionshort readShort()
throws IOException
IOExceptionint readInt()
throws IOException
IOExceptionlong readLong()
throws IOException
IOExceptionfloat readFloat()
throws IOException
IOExceptiondouble readDouble()
throws IOException
IOExceptionvoid readBooleanArray(boolean[] data)
throws IOException
IOExceptionvoid readByteArray(byte[] data)
throws IOException
IOExceptionvoid readByteArray(byte[] data,
int offset,
int length)
throws IOException
IOExceptionvoid readBytes(Buffer buffer) throws IOException
IOExceptionvoid readCharArray(char[] data)
throws IOException
IOExceptionvoid readShortArray(short[] data)
throws IOException
IOExceptionvoid readIntArray(int[] data)
throws IOException
IOExceptionvoid readLongArray(long[] data)
throws IOException
IOExceptionvoid readFloatArray(float[] data)
throws IOException
IOExceptionvoid readDoubleArray(double[] data)
throws IOException
IOExceptionvoid skip(int length)
<E> GrizzlyFuture<E> decode(Transformer<Stream,E> decoder)
E - decoded data typedecoder - TransformerFuture, which will hold the decoding state.<E> GrizzlyFuture<E> decode(Transformer<Stream,E> decoder, CompletionHandler<E> completionHandler)
E - decoded data typedecoder - TransformercompletionHandler - 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 © 2017–2020 Oracle Corporation. All rights reserved.