public interface Stream extends BufferProvider
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the connection.
|
ServerAddress |
getAddress()
The address that this stream is connected to.
|
boolean |
isClosed()
Returns the closed state of the connection
|
void |
open()
Open the stream.
|
void |
openAsync(AsyncCompletionHandler<java.lang.Void> handler)
Open the stream asynchronously.
|
ByteBuf |
read(int numBytes)
Read from the stream, blocking until the requested number of bytes have been read.
|
void |
readAsync(int numBytes,
AsyncCompletionHandler<ByteBuf> handler)
Read from the stream, asynchronously.
|
void |
write(java.util.List<ByteBuf> buffers)
Write each buffer in the list to the stream in order, blocking until all are completely written.
|
void |
writeAsync(java.util.List<ByteBuf> buffers,
AsyncCompletionHandler<java.lang.Void> handler)
Write each buffer in the list to the stream in order, asynchronously.
|
getBuffer
void open() throws java.io.IOException
java.io.IOException
- if an I/O error occursvoid openAsync(AsyncCompletionHandler<java.lang.Void> handler)
handler
- the completion handler for opening the streamvoid write(java.util.List<ByteBuf> buffers) throws java.io.IOException
buffers
- the buffers to writejava.io.IOException
- if there are problems writing to the streamByteBuf read(int numBytes) throws java.io.IOException
numBytes
- The number of bytes to read into the returned byte bufferjava.io.IOException
- if there are problems reading from the streamvoid writeAsync(java.util.List<ByteBuf> buffers, AsyncCompletionHandler<java.lang.Void> handler)
buffers
- the buffers to writehandler
- invoked when the read operation has completedvoid readAsync(int numBytes, AsyncCompletionHandler<ByteBuf> handler)
numBytes
- the number of byteshandler
- invoked when the read operation has completedServerAddress getAddress()
void close()
boolean isClosed()