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 TypeMethodDescriptionvoid
close()
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> T
Get the value of a channel option.Get the worker for this channel.boolean
isOpen()
<T> T
Set an option for this channel.boolean
supportsOption
(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:CloseableChannel
Get 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:
getCloseSetter
in interfaceCloseableChannel
- Returns:
- the setter
-
getWorker
Description copied from interface:CloseableChannel
Get the worker for this channel.- Specified by:
getWorker
in interfaceCloseableChannel
- Returns:
- the worker
-
getIoThread
Description copied from interface:CloseableChannel
Get the I/O thread associated with this channel.- Specified by:
getIoThread
in interfaceCloseableChannel
- Returns:
- the I/O thread associated with this channel
-
close
Description copied from interface:CloseableChannel
Close this channel. When a channel is closed, its close listener is invoked. Invoking this method more than once has no additional effect.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceChannel
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceCloseableChannel
- Specified by:
close
in interfaceInterruptibleChannel
- Throws:
IOException
- if the close failed
-
isOpen
public boolean isOpen() -
supportsOption
Description copied from interface:Configurable
Determine whether an option is supported on this channel.- Specified by:
supportsOption
in interfaceConfigurable
- Parameters:
option
- the option- Returns:
true
if it is supported
-
getOption
Description copied from interface:Configurable
Get the value of a channel option.- Specified by:
getOption
in interfaceConfigurable
- Type Parameters:
T
- the type of the option value- Parameters:
option
- the option to get- Returns:
- the value of the option, or
null
if it is not set - Throws:
IOException
- if an I/O error occurred when reading the option
-
setOption
Description copied from interface:Configurable
Set an option for this channel. Unsupported options are ignored.- Specified by:
setOption
in 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
-