public abstract class AbstractSocketChannelConnection extends java.lang.Object implements Connection
| Modifier and Type | Field and Description |
|---|---|
protected int |
receiveBufferSizeHint |
protected int |
sendBufferSizeHint |
protected java.nio.channels.SocketChannel |
socketChannel |
NO_HINT_VALUE| Modifier | Constructor and Description |
|---|---|
protected |
AbstractSocketChannelConnection(int sendBufferSizeHint,
int receiveBufferSizeHint,
org.slf4j.Logger log) |
| Modifier and Type | Method and Description |
|---|---|
void |
connect(java.lang.String hostname,
int port) |
void |
disconnect() |
boolean |
isConnected() |
protected abstract java.nio.channels.SocketChannel |
openChannel(java.lang.String hostname,
int port) |
protected void |
setBufferSizes(java.nio.channels.SocketChannel socketChannel) |
void |
writeFrom(java.nio.ByteBuffer byteBuffer)
Writes as many bytes from the byteBuffer to the output channel of this Connection.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitreadIntoprotected final int sendBufferSizeHint
protected final int receiveBufferSizeHint
protected java.nio.channels.SocketChannel socketChannel
protected AbstractSocketChannelConnection(int sendBufferSizeHint,
int receiveBufferSizeHint,
org.slf4j.Logger log)
public void connect(java.lang.String hostname,
int port)
throws java.io.IOException
connect in interface Connectionjava.io.IOExceptionprotected abstract java.nio.channels.SocketChannel openChannel(java.lang.String hostname,
int port)
throws java.io.IOException
java.io.IOExceptionpublic void disconnect()
throws java.io.IOException
disconnect in interface Connectionjava.io.IOExceptionpublic void writeFrom(java.nio.ByteBuffer byteBuffer)
throws java.io.IOException
ConnectionwriteFrom in interface ConnectionbyteBuffer - source of the bytes to writejava.io.IOException - if anything goes wrongpublic boolean isConnected()
isConnected in interface Connectionprotected void setBufferSizes(java.nio.channels.SocketChannel socketChannel)
throws java.io.IOException
java.io.IOException