public class SelectableConnection extends AbstractSocketChannelConnection
ChannelRegistry for reading and writing (when there are pending bytes to
write).receiveBufferSizeHint, sendBufferSizeHint, socketChannelNO_HINT_VALUE| Constructor and Description |
|---|
SelectableConnection(int sendBufferSizeHint,
int receiveBufferSizeHint,
ChannelRegistry channelManager) |
| Modifier and Type | Method and Description |
|---|---|
protected java.nio.channels.SocketChannel |
openChannel(java.lang.String hostname,
int port) |
int |
readInto(java.nio.ByteBuffer byteBuffer)
Reads as many bytes from the input channel of this Connection into the provided ByteBuffer.
|
void |
writeFrom(java.nio.ByteBuffer byteBuffer)
Writes as many bytes from the byteBuffer to the output channel of this Connection.
|
connect, disconnect, isConnected, setBufferSizespublic SelectableConnection(int sendBufferSizeHint,
int receiveBufferSizeHint,
ChannelRegistry channelManager)
protected java.nio.channels.SocketChannel openChannel(java.lang.String hostname,
int port)
throws java.io.IOException
openChannel in class AbstractSocketChannelConnectionjava.io.IOExceptionpublic int readInto(java.nio.ByteBuffer byteBuffer)
throws java.io.IOException
ConnectionbyteBuffer - destination of the read bytesjava.io.IOException - if anything goes wrongpublic void writeFrom(java.nio.ByteBuffer byteBuffer)
throws java.io.IOException
ConnectionwriteFrom in interface ConnectionwriteFrom in class AbstractSocketChannelConnectionbyteBuffer - source of the bytes to writejava.io.IOException - if anything goes wrong