Package org.xnio.channels

# Class AssembledConnectedChannel

java.lang.Object
org.xnio.channels.AssembledChannel
org.xnio.channels.AssembledConnectedChannel

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`, `Channel`, `InterruptibleChannel`, `BoundChannel`, `CloseableChannel`, `Configurable`, `ConnectedChannel`

Direct Known Subclasses:
  `AssembledSslChannel`

public class AssembledConnectedChannel extends AssembledChannel implements ConnectedChannel
A closeable, connected view over a read and write side of a suspendable channel, at least one of which is connected.

Author:
  David M. Lloyd

## Field Summary

### Fields inherited from interface org.xnio.channels.Configurable

`EMPTY`

## Constructor Summary

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

## Method Summary

Modifier and Type
Method
Description
`ChannelListener.Setter<? extends AssembledConnectedChannel>`
`getCloseSetter()`
Get the setter which can be used to change the close listener for this channel.
`SocketAddress`
`getLocalAddress()`
Get the local address that this channel is bound to.
`<A extends SocketAddress>
A`
`getLocalAddress(Class<A> type)`
Get the local address of a given type, or `null` if the address is not of that type.
`SocketAddress`
`getPeerAddress()`
Get the peer address of this channel.
`<A extends SocketAddress>
A`
`getPeerAddress(Class<A> type)`
Get the peer address of a given type, or `null` if the address is not of that type.

### Methods inherited from class org.xnio.channels.AssembledChannel

`close, getIoThread, getOption, getWorker, isOpen, setOption, supportsOption`

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

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

### Methods inherited from interface java.nio.channels.Channel

`isOpen`

### Methods inherited from interface org.xnio.channels.CloseableChannel

`close, getIoThread, getWorker`

### Methods inherited from interface org.xnio.channels.Configurable

`getOption, setOption, supportsOption`

## Constructor Details

### AssembledConnectedChannel

public AssembledConnectedChannel(SuspendableReadChannel readChannel, SuspendableWriteChannel writeChannel)
Construct a new instance. At least one of the channels must be an instance of `ConnectedChannel`.

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

## Method Details

### getCloseSetter

public ChannelListener.Setter<? extends AssembledConnectedChannel> 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 `BoundChannel`
Specified by:
  `getCloseSetter` in interface `CloseableChannel`
Specified by:
  `getCloseSetter` in interface `ConnectedChannel`
Overrides:
  `getCloseSetter` in class `AssembledChannel`
Returns:
  the setter

### getPeerAddress

public SocketAddress getPeerAddress()
Description copied from interface: `ConnectedChannel`
Get the peer address of this channel.

Specified by:
  `getPeerAddress` in interface `ConnectedChannel`
Returns:
  the peer address

### getPeerAddress

public <A extends SocketAddress> A getPeerAddress(Class<A> type)
Description copied from interface: `ConnectedChannel`
Get the peer address of a given type, or `null` if the address is not of that type.

Specified by:
  `getPeerAddress` in interface `ConnectedChannel`
Parameters:
  `type` - the address type class
Returns:
  the peer address, or `null` if unknown

### getLocalAddress

public SocketAddress getLocalAddress()
Description copied from interface: `BoundChannel`
Get the local address that this channel is bound to.

Specified by:
  `getLocalAddress` in interface `BoundChannel`
Returns:
  the local address

### getLocalAddress

public <A extends SocketAddress> A getLocalAddress(Class<A> type)
Description copied from interface: `BoundChannel`
Get the local address of a given type, or `null` if the address is not of that type.

Specified by:
  `getLocalAddress` in interface `BoundChannel`
Type Parameters:
  `A` - the address type
Parameters:
  `type` - the address type class
Returns:
  the local address, or `null` if unknown