Package org.xnio.channels
Class AssembledChannel
java.lang.Object
org.xnio.channels.AssembledChannel
- All Implemented Interfaces:
Closeable,AutoCloseable,Channel,InterruptibleChannel,CloseableChannel,Configurable
- Direct Known Subclasses:
AssembledConnectedChannel
A closeable view over a read and write side of a suspendable channel.
- Author:
- David M. Lloyd
-
Field Summary
Fields inherited from interface org.xnio.channels.Configurable
EMPTY -
Constructor Summary
ConstructorsConstructorDescriptionAssembledChannel(SuspendableReadChannel readChannel, SuspendableWriteChannel writeChannel) Construct a new instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close this channel.ChannelListener.Setter<? extends CloseableChannel>Get the setter which can be used to change the close listener for this channel.Get the I/O thread associated with this channel.<T> TGet the value of a channel option.Get the worker for this channel.booleanisOpen()<T> TSet an option for this channel.booleansupportsOption(Option<?> option) Determine whether an option is supported on this channel.
-
Constructor Details
-
AssembledChannel
Construct a new instance.- Parameters:
readChannel- the read sidewriteChannel- the write side
-
-
Method Details
-
getCloseSetter
Description copied from interface:CloseableChannelGet the setter which can be used to change the close listener for this channel. If the channel is already closed, then the listener will not be called.- Specified by:
getCloseSetterin interfaceCloseableChannel- Returns:
- the setter
-
getWorker
Description copied from interface:CloseableChannelGet the worker for this channel.- Specified by:
getWorkerin interfaceCloseableChannel- Returns:
- the worker
-
getIoThread
Description copied from interface:CloseableChannelGet the I/O thread associated with this channel.- Specified by:
getIoThreadin interfaceCloseableChannel- Returns:
- the I/O thread associated with this channel
-
close
Description copied from interface:CloseableChannelClose this channel. When a channel is closed, its close listener is invoked. Invoking this method more than once has no additional effect.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceCloseableChannel- Specified by:
closein interfaceInterruptibleChannel- Throws:
IOException- if the close failed
-
isOpen
public boolean isOpen() -
supportsOption
Description copied from interface:ConfigurableDetermine whether an option is supported on this channel.- Specified by:
supportsOptionin interfaceConfigurable- Parameters:
option- the option- Returns:
trueif it is supported
-
getOption
Description copied from interface:ConfigurableGet the value of a channel option.- Specified by:
getOptionin interfaceConfigurable- Type Parameters:
T- the type of the option value- Parameters:
option- the option to get- Returns:
- the value of the option, or
nullif it is not set - Throws:
IOException- if an I/O error occurred when reading the option
-
setOption
Description copied from interface:ConfigurableSet an option for this channel. Unsupported options are ignored.- Specified by:
setOptionin interfaceConfigurable- Type Parameters:
T- the type of the option value- Parameters:
option- the option to setvalue- the value of the option to set- Returns:
- the previous option value, if any
- Throws:
IllegalArgumentException- if the value is not acceptable for this optionIOException- if an I/O error occurred when modifying the option
-