NioChannelTcpNioSocketChannelpublic class NioSocketChannel extends AbstractNioChannel<java.nio.channels.SocketChannel>
| Constructor | Description |
|---|---|
NioSocketChannel(java.nio.channels.SocketChannel socketChannel,
SocketSelector selector) |
| Modifier and Type | Method | Description |
|---|---|---|
void |
addConnectListener(ActionListener<java.lang.Void> listener) |
|
void |
closeFromSelector() |
Closes the channel synchronously.
|
boolean |
finishConnect() |
This method will attempt to complete the connection process for this channel.
|
java.util.function.BiConsumer<NioSocketChannel,java.lang.Exception> |
getExceptionContext() |
|
ReadContext |
getReadContext() |
|
java.net.InetSocketAddress |
getRemoteAddress() |
|
SocketSelector |
getSelector() |
|
WriteContext |
getWriteContext() |
|
boolean |
isConnectComplete() |
|
boolean |
isReadable() |
|
boolean |
isWritable() |
|
int |
read(InboundChannelBuffer buffer) |
|
void |
setContexts(ReadContext readContext,
WriteContext writeContext,
java.util.function.BiConsumer<NioSocketChannel,java.lang.Exception> exceptionContext) |
|
java.lang.String |
toString() |
|
int |
write(java.nio.ByteBuffer[] buffers) |
addCloseListener, close, getLocalAddress, getRawChannel, getSelectionKey, isOpen, registerpublic NioSocketChannel(java.nio.channels.SocketChannel socketChannel,
SocketSelector selector)
throws java.io.IOException
java.io.IOExceptionpublic void closeFromSelector()
throws java.io.IOException
AbstractNioChannelOnce this method returns, the channel will be closed.
closeFromSelector in interface NioChannelcloseFromSelector in class AbstractNioChannel<java.nio.channels.SocketChannel>java.io.IOExceptionpublic SocketSelector getSelector()
getSelector in interface NioChannelgetSelector in class AbstractNioChannel<java.nio.channels.SocketChannel>public int write(java.nio.ByteBuffer[] buffers)
throws java.io.IOException
java.io.IOExceptionpublic int read(InboundChannelBuffer buffer) throws java.io.IOException
java.io.IOExceptionpublic void setContexts(ReadContext readContext, WriteContext writeContext, java.util.function.BiConsumer<NioSocketChannel,java.lang.Exception> exceptionContext)
public WriteContext getWriteContext()
public ReadContext getReadContext()
public java.util.function.BiConsumer<NioSocketChannel,java.lang.Exception> getExceptionContext()
public java.net.InetSocketAddress getRemoteAddress()
public boolean isConnectComplete()
public boolean isWritable()
public boolean isReadable()
public boolean finishConnect()
throws java.io.IOException
java.io.IOException - if an I/O error occurspublic void addConnectListener(ActionListener<java.lang.Void> listener)
public java.lang.String toString()
toString in class java.lang.Object