public final class AsynchronousSocketChannelStream extends Object implements Stream
| Constructor and Description |
|---|
AsynchronousSocketChannelStream(ServerAddress serverAddress,
SocketSettings settings,
BufferProvider bufferProvider,
AsynchronousChannelGroup group) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the connection.
|
ServerAddress |
getAddress()
The address that this stream is connected to.
|
ByteBuf |
getBuffer(int size)
Gets a buffer with the givens capacity.
|
AsynchronousChannelGroup |
getGroup() |
ServerAddress |
getServerAddress() |
SocketSettings |
getSettings() |
boolean |
isClosed()
Returns the closed state of the connection
|
void |
open()
Open the stream.
|
void |
openAsync(AsyncCompletionHandler<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(List<ByteBuf> buffers)
Write each buffer in the list to the stream in order, blocking until all are completely written.
|
void |
writeAsync(List<ByteBuf> buffers,
AsyncCompletionHandler<Void> handler)
Write each buffer in the list to the stream in order, asynchronously.
|
public AsynchronousSocketChannelStream(ServerAddress serverAddress, SocketSettings settings, BufferProvider bufferProvider, AsynchronousChannelGroup group)
public ByteBuf getBuffer(int size)
BufferProvidergetBuffer in interface BufferProvidersize - the size required for the bufferpublic void open()
throws IOException
Streamopen in interface StreamIOException - if an I/O error occurspublic void openAsync(AsyncCompletionHandler<Void> handler)
Streampublic void write(List<ByteBuf> buffers) throws IOException
Streamwrite in interface Streambuffers - the buffers to writeIOException - if there are problems writing to the streampublic ByteBuf read(int numBytes) throws IOException
Streamread in interface StreamnumBytes - The number of bytes to read into the returned byte bufferIOException - if there are problems reading from the streampublic void writeAsync(List<ByteBuf> buffers, AsyncCompletionHandler<Void> handler)
StreamwriteAsync in interface Streambuffers - the buffers to writehandler - invoked when the read operation has completedpublic void readAsync(int numBytes,
AsyncCompletionHandler<ByteBuf> handler)
Streampublic ServerAddress getAddress()
StreamgetAddress in interface Streampublic boolean isClosed()
Streampublic ServerAddress getServerAddress()
public SocketSettings getSettings()
public AsynchronousChannelGroup getGroup()
Copyright © 2010 - 2020 Adobe. All Rights Reserved