java.nio.channels.spi

Class AbstractSelectableChannel

public abstract class AbstractSelectableChannel extends SelectableChannel

Constructor Summary
protected AbstractSelectableChannel(SelectorProvider provider)
Initializes the channel
Method Summary
ObjectblockingLock()
Retrieves the object upon which the configureBlocking and register methods synchronize.
SelectableChannelconfigureBlocking(boolean blocking)
Adjusts this channel's blocking mode.
protected voidimplCloseChannel()
Closes this channel.
protected abstract voidimplCloseSelectableChannel()
Closes this selectable channel.
protected abstract voidimplConfigureBlocking(boolean blocking)
Adjusts this channel's blocking mode.
booleanisBlocking()
Tells whether or not every I/O operation on this channel will block until it completes.
booleanisRegistered()
Tells whether or not this channel is currently registered with any selectors.
SelectionKeykeyFor(Selector selector)
Retrieves the key representing the channel's registration with the given selector.
SelectorProviderprovider()
Returns the provider that created this channel.
SelectionKeyregister(Selector selin, int ops, Object att)
Registers this channel with the given selector, returning a selection key.

Constructor Detail

AbstractSelectableChannel

protected AbstractSelectableChannel(SelectorProvider provider)
Initializes the channel

Parameters: provider the provider that created this channel

Method Detail

blockingLock

public final Object blockingLock()
Retrieves the object upon which the configureBlocking and register methods synchronize.

Returns: the blocking lock

configureBlocking

public final SelectableChannel configureBlocking(boolean blocking)
Adjusts this channel's blocking mode.

Parameters: blocking true if blocking should be enabled, false otherwise

Returns: this channel

Throws: IOException If an error occurs

implCloseChannel

protected final void implCloseChannel()
Closes this channel.

Throws: IOException If an error occurs

implCloseSelectableChannel

protected abstract void implCloseSelectableChannel()
Closes this selectable channel.

Throws: IOException If an error occurs

implConfigureBlocking

protected abstract void implConfigureBlocking(boolean blocking)
Adjusts this channel's blocking mode.

Parameters: blocking true if blocking should be enabled, false otherwise

Throws: IOException If an error occurs

isBlocking

public final boolean isBlocking()
Tells whether or not every I/O operation on this channel will block until it completes.

Returns: true of this channel is blocking, false otherwise

isRegistered

public final boolean isRegistered()
Tells whether or not this channel is currently registered with any selectors.

Returns: true if this channel is registered, false otherwise

keyFor

public final SelectionKey keyFor(Selector selector)
Retrieves the key representing the channel's registration with the given selector.

Parameters: selector the selector to get a selection key for

Returns: the selection key this channel is registered with

provider

public final SelectorProvider provider()
Returns the provider that created this channel.

Returns: the selector provider that created this channel

register

public final SelectionKey register(Selector selin, int ops, Object att)
Registers this channel with the given selector, returning a selection key.

Parameters: selin the seletor to use ops the interested operations att an attachment for the returned selection key

Returns: the registered selection key

Throws: ClosedChannelException If the channel is already closed. IllegalBlockingModeException If the channel is configured in blocking mode.