public interface Channel extends Flushable, Closeable, Link
| Modifier and Type | Interface and Description |
|---|---|
static interface |
Channel.Listener |
static interface |
Channel.Recycler |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close channel, flushing any remaining output first.
|
void |
disconnect()
Forcibly close channel, potentially discarding unflushed output and any
exceptions.
|
InputStream |
getInputStream()
Returns an input stream for the channel, which when closed, closes the
channel.
|
OutputStream |
getOutputStream()
Returns an output stream for the channel, which when closed, closes the
channel.
|
void |
inputNotify(Channel.Listener listener)
Register a listener which is asynchronously notified when a call to
isInputReady will return true.
|
boolean |
inputResume()
Allows input to resume after reading a suspend marker.
|
Remote |
installRecycler(Channel.Recycler recycler)
Install a recycler which is called after this channel has been closed
and a recyled channel has been created.
|
boolean |
isClosed()
Returns true if channel is absolutely closed or disconnected.
|
boolean |
isInputReady()
Returns true if bytes can read from channel without blocking.
|
boolean |
isOutputReady()
Returns true if bytes can written to channel without blocking.
|
boolean |
isResumeSupported() |
void |
outputNotify(Channel.Listener listener)
Register a listener which is asynchronously notified when a call to
isOutputReady will return true.
|
boolean |
outputSuspend()
If supported, writes a suspend marker and flushes the output.
|
void |
register(CloseableGroup<? super Channel> group)
Register this channel with at least one group.
|
int |
setInputBufferSize(int size)
Sets the size of the input buffer, returning the actual size applied.
|
int |
setOutputBufferSize(int size)
Sets the size of the output buffer, returning the actual size applied.
|
void |
setRecycleControl(Remote control)
Set the recycling control object from the remote channel
endpoint.
|
boolean |
usesSelectNotification()
Returns true to indicate that asynchronous notifications use channel
selection instead of blocked threads.
|
getLocalAddress, getRemoteAddressInputStream getInputStream()
OutputStream getOutputStream()
boolean isInputReady()
throws IOException
IOException - if channel is closedboolean isOutputReady()
throws IOException
IOException - if channel is closedint setInputBufferSize(int size)
int setOutputBufferSize(int size)
void inputNotify(Channel.Listener listener)
void outputNotify(Channel.Listener listener)
boolean usesSelectNotification()
boolean inputResume()
boolean isResumeSupported()
boolean outputSuspend()
throws IOException
IOExceptionvoid register(CloseableGroup<? super Channel> group)
boolean isClosed()
void close()
throws IOException
close in interface AutoCloseableclose in interface CloseableIOExceptionvoid disconnect()
Remote installRecycler(Channel.Recycler recycler)
IllegalStateException - if a recycler is already installedvoid setRecycleControl(Remote control)
IllegalArgumentException - if channel uses control feature and
instance is same as local control or is unsupportedCopyright © 2006–2015 Cojen. All rights reserved.