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<java.lang.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<java.lang.Integer> |
notifyAvailable(int size,
CompletionHandler<java.lang.Integer> completionHandler)
Method returns
Future, using which it's possible check if
StreamReader has required amount of bytes available
for reading reading. |
GrizzlyFuture<java.lang.Integer> |
notifyCondition(Condition condition)
Method returns
Future, using which it's possible check if
StreamReader meets specific Condition. |
GrizzlyFuture<java.lang.Integer> |
notifyCondition(Condition condition,
CompletionHandler<java.lang.Integer> completionHandler)
Method returns
Future, using which it's possible check if
StreamReader meets specific Condition. |
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<java.lang.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<java.lang.Integer> notifyAvailable(int size, CompletionHandler<java.lang.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<java.lang.Integer> notifyCondition(Condition condition)
Future, using which it's possible check if
StreamReader meets specific Condition.GrizzlyFuture<java.lang.Integer> notifyCondition(Condition condition, CompletionHandler<java.lang.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 java.io.IOException
java.io.IOExceptionbyte readByte()
throws java.io.IOException
java.io.IOExceptionchar readChar()
throws java.io.IOException
java.io.IOExceptionshort readShort()
throws java.io.IOException
java.io.IOExceptionint readInt()
throws java.io.IOException
java.io.IOExceptionlong readLong()
throws java.io.IOException
java.io.IOExceptionfloat readFloat()
throws java.io.IOException
java.io.IOExceptiondouble readDouble()
throws java.io.IOException
java.io.IOExceptionvoid readBooleanArray(boolean[] data)
throws java.io.IOException
java.io.IOExceptionvoid readByteArray(byte[] data)
throws java.io.IOException
java.io.IOExceptionvoid readByteArray(byte[] data,
int offset,
int length)
throws java.io.IOException
java.io.IOExceptionvoid readBytes(Buffer buffer) throws java.io.IOException
java.io.IOExceptionvoid readCharArray(char[] data)
throws java.io.IOException
java.io.IOExceptionvoid readShortArray(short[] data)
throws java.io.IOException
java.io.IOExceptionvoid readIntArray(int[] data)
throws java.io.IOException
java.io.IOExceptionvoid readLongArray(long[] data)
throws java.io.IOException
java.io.IOExceptionvoid readFloatArray(float[] data)
throws java.io.IOException
java.io.IOExceptionvoid readDoubleArray(double[] data)
throws java.io.IOException
java.io.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 © 2013 Oracle Corporation. All Rights Reserved.