|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.nio.channels.spi.AbstractInterruptibleChannel
java.nio.channels.SelectableChannel
public abstract class SelectableChannel
A channel that can be detected by a selector. The channel can be registered with some selectors, and when invoke select method of the selectors, the channel can be checked if it is readable, writable, connectable or acceptable according to its interesting operation.
| Constructor Summary | |
|---|---|
protected |
SelectableChannel()
Default constructor, can be overridden. |
| Method Summary | |
|---|---|
abstract Object |
blockingLock()
Gets the blocking lock which synchronizes the configureBlocking and register methods. |
abstract SelectableChannel |
configureBlocking(boolean block)
Sets blocking mode of the channel. |
abstract boolean |
isBlocking()
Returns if channel is in blocking mode. |
abstract boolean |
isRegistered()
Returns if channel is registered. |
abstract SelectionKey |
keyFor(Selector sel)
Gets the selection key for the channel with the given selector. |
abstract SelectorProvider |
provider()
Gets the provider of the channel. |
SelectionKey |
register(Selector selector,
int operations)
Registers with the given selector with a certain interesting operation. |
abstract SelectionKey |
register(Selector sel,
int ops,
Object att)
Registers with the given selector with a certain interesting operation and an attached object. |
abstract int |
validOps()
Gets the possible interesting operation of the channel. |
| Methods inherited from class java.nio.channels.spi.AbstractInterruptibleChannel |
|---|
begin, close, end, implCloseChannel, isOpen |
| 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 |
|---|
close, isOpen |
| Constructor Detail |
|---|
protected SelectableChannel()
| Method Detail |
|---|
public abstract Object blockingLock()
public abstract SelectableChannel configureBlocking(boolean block)
throws IOException
block - true as blocking, false as non-blocking
ClosedChannelException - If this channel has been closed
IllegalBlockingModeException - If the channel has been registered
IOException - if I/O error occurspublic abstract boolean isBlocking()
public abstract boolean isRegistered()
public abstract SelectionKey keyFor(Selector sel)
sel - the selector with which this channel may register
public abstract SelectorProvider provider()
public final SelectionKey register(Selector selector,
int operations)
throws ClosedChannelException
selector - the selector with which this channel shall be registeredoperations - the interesting operation
ClosedChannelException - if the channel is closed
IllegalBlockingModeException - If the channel is in blocking mode
IllegalSelectorException - If this channel does not have the same provider as the
given selector
CancelledKeyException - If this channel is registered but its key has been cancelled
IllegalArgumentException - If the operation given is unsupported by this channel
public abstract SelectionKey register(Selector sel,
int ops,
Object att)
throws ClosedChannelException
sel - the selector with which this channel shall be registeredops - the interesting operationatt - The attached object, which can be null
ClosedChannelException - if the channel is closed
IllegalBlockingModeException - If the channel is in blocking mode
IllegalSelectorException - If this channel does not have the same provider with the
given selector
CancelledKeyException - If this channel is registered but its key has been cancelled
IllegalArgumentException - If the operation given is unsupported by this channelpublic abstract int validOps()
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||