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`

public class AssembledChannel extends Object implements CloseableChannel
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

Constructors
Constructor
Description
`AssembledChannel(SuspendableReadChannel readChannel, SuspendableWriteChannel writeChannel)`
Construct a new instance.

## Method Summary

Modifier and Type
Method
Description
`void`
`close()`
Close this channel.
`ChannelListener.Setter<? extends CloseableChannel>`
`getCloseSetter()`
Get the setter which can be used to change the close listener for this channel.
`XnioIoThread`
`getIoThread()`
Get the I/O thread associated with this channel.
`<T> T`
`getOption(Option<T> option)`
Get the value of a channel option.
`XnioWorker`
`getWorker()`
Get the worker for this channel.
`boolean`
`isOpen()`
`<T> T`
`setOption(Option<T> option, T value)`
Set an option for this channel.
`boolean`
`supportsOption(Option<?> option)`
Determine whether an option is supported on this channel.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### AssembledChannel

public AssembledChannel(SuspendableReadChannel readChannel, SuspendableWriteChannel writeChannel)
Construct a new instance.

Parameters:
  `readChannel` - the read side
  `writeChannel` - the write side

## Method Details

### getCloseSetter

public ChannelListener.Setter<? extends CloseableChannel> 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 interface `CloseableChannel`
Returns:
  the setter

### getWorker

public XnioWorker getWorker()
Description copied from interface: `CloseableChannel`
Get the worker for this channel.

Specified by:
  `getWorker` in interface `CloseableChannel`
Returns:
  the worker

### getIoThread

public XnioIoThread getIoThread()
Description copied from interface: `CloseableChannel`
Get the I/O thread associated with this channel.

Specified by:
  `getIoThread` in interface `CloseableChannel`
Returns:
  the I/O thread associated with this channel

### close

public void close() throws IOException
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 interface `AutoCloseable`
Specified by:
  `close` in interface `Channel`
Specified by:
  `close` in interface `Closeable`
Specified by:
  `close` in interface `CloseableChannel`
Specified by:
  `close` in interface `InterruptibleChannel`
Throws:
  `IOException` - if the close failed

### isOpen

public boolean isOpen()

Specified by:
  `isOpen` in interface `Channel`

### supportsOption

public boolean supportsOption(Option<?> option)
Description copied from interface: `Configurable`
Determine whether an option is supported on this channel.

Specified by:
  `supportsOption` in interface `Configurable`
Parameters:
  `option` - the option
Returns:
  `true` if it is supported

### getOption

public <T> T getOption(Option<T> option) throws IOException
Description copied from interface: `Configurable`
Get the value of a channel option.

Specified by:
  `getOption` in interface `Configurable`
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

public <T> T setOption(Option<T> option, T value) throws IllegalArgumentException, IOException
Description copied from interface: `Configurable`
Set an option for this channel. Unsupported options are ignored.

Specified by:
  `setOption` in interface `Configurable`
Type Parameters:
  `T` - the type of the option value
Parameters:
  `option` - the option to set
  `value` - the value of the option to set
Returns:
  the previous option value, if any
Throws:
  `IllegalArgumentException` - if the value is not acceptable for this option
  `IOException` - if an I/O error occurred when modifying the option