java.nio.channels
public
abstract
class
java.nio.channels.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.
Known Direct Subclasses
Known Indirect Subclasses
DatagramChannel |
A DatagramChannel is a selectable channel for part abstraction of datagram
socket. |
Pipe.SinkChannel |
Writable sink channel for writing into. |
Pipe.SourceChannel |
Readable source channel for reading from. |
ServerSocketChannel |
A ServerSocketChannel is a partly abstracted stream-oriented listening socket
which is selectable. |
SocketChannel |
A SocketChannel is a selectable channel for part abstraction of stream
connecting socket. |
Summary
Protected Constructors
Public Methods
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Protected Constructors
protected
SelectableChannel()
Default constructor, can be overridden.
Public Methods
public
abstract
Object
blockingLock()
Gets the blocking lock which synchronizes the configureBlocking and
register methods.
Returns
- the blocking object as lock
public
abstract
SelectableChannel
configureBlocking(boolean block)
Sets blocking mode of the channel.
Parameters
block
| true as blocking, false as non-blocking |
public
abstract
boolean
isBlocking()
Returns if channel is in blocking mode.
Returns
- true if channel is blocking
public
abstract
boolean
isRegistered()
Returns if channel is registered.
Returns
- true if channel is registered
Gets the selection key for the channel with the given selector.
Parameters
sel
| the selector with which this channel may register |
Returns
- the selection key for the channel according to the given selector
Gets the provider of the channel.
Returns
- the provider of the channel
Registers with the given selector with a certain interesting operation
and an attached object.
Parameters
sel
| the selector with which this channel shall be registered |
ops
| the interesting operation |
att
| The attached object, which can be null |
Returns
- the selection key indicates the channel
public
final
SelectionKey
register(Selector selector, int operations)
Registers with the given selector with a certain interesting operation.
Parameters
selector
| the selector with which this channel shall be registered |
operations
| the interesting operation |
Returns
- the selection key indicates the channel
public
abstract
int
validOps()
Gets the possible interesting operation of the channel.
Returns
- the possible interesting operation of the channel