|
||||||||||
| 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 | ||
|---|---|---|
int |
available()
Return the number of bytes available for get calls. |
|
|
decode(Transformer<Stream,E> decoder)
Read and decode data from the StreamReader |
|
|
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()
|
|
| Methods inherited from interface org.glassfish.grizzly.streams.Stream |
|---|
getConnection |
| Methods inherited from interface java.io.Closeable |
|---|
close |
| Method Detail |
|---|
GrizzlyFuture<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.
condition - Condition StreamReader should meet.
Future, using which it's possible to check whether
StreamReader meets the required 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.IOException
byte readByte()
throws java.io.IOException
java.io.IOException
char readChar()
throws java.io.IOException
java.io.IOException
short readShort()
throws java.io.IOException
java.io.IOException
int readInt()
throws java.io.IOException
java.io.IOException
long readLong()
throws java.io.IOException
java.io.IOException
float readFloat()
throws java.io.IOException
java.io.IOException
double readDouble()
throws java.io.IOException
java.io.IOException
void readBooleanArray(boolean[] data)
throws java.io.IOException
java.io.IOException
void readByteArray(byte[] data)
throws java.io.IOException
java.io.IOException
void readByteArray(byte[] data,
int offset,
int length)
throws java.io.IOException
java.io.IOException
void readBytes(Buffer buffer)
throws java.io.IOException
java.io.IOException
void readCharArray(char[] data)
throws java.io.IOException
java.io.IOException
void readShortArray(short[] data)
throws java.io.IOException
java.io.IOException
void readIntArray(int[] data)
throws java.io.IOException
java.io.IOException
void readLongArray(long[] data)
throws java.io.IOException
java.io.IOException
void readFloatArray(float[] data)
throws java.io.IOException
java.io.IOException
void 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 - Transformer
Future, 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()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||