java.nio.channels
public abstract class SelectionKey extends Object
Since: 1.4
Field Summary | |
---|---|
static int | OP_ACCEPT |
static int | OP_CONNECT |
static int | OP_READ |
static int | OP_WRITE |
Constructor Summary | |
---|---|
protected | SelectionKey()
Initializes the selection key. |
Method Summary | |
---|---|
Object | attach(Object obj)
Attaches obj to the key and returns the old attached object. |
Object | attachment()
Returns the object attached to the key. |
abstract void | cancel()
Requests that the registration of this key's channel with
its selector be cancelled. |
abstract SelectableChannel | channel()
return the channel attached to the key. |
abstract int | interestOps()
Returns the key's interest set.
|
abstract SelectionKey | interestOps(int ops)
Sets this key's interest set to the given value.
|
boolean | isAcceptable()
Tests if the channel attached to this key is ready to accept
a new socket connection.
|
boolean | isConnectable()
Tests whether this key's channel has either finished,
or failed to finish, its socket-connection operation.
|
boolean | isReadable()
Tests if the channel attached to the key is readable.
|
abstract boolean | isValid()
Tells whether or not this key is valid. |
boolean | isWritable()
Tests if the channel attached to the key is writable.
|
abstract int | readyOps()
Retrieves this key's ready-operation set.
|
abstract Selector | selector()
Returns the selector for which this key was created. |
Throws: CancelledKeyException If this key has been cancelled
Throws: CancelledKeyException If this key has been cancelled IllegalArgumentException If a bit in the set does not correspond to an operation that is supported by this key's channel, that is, if set & ~(channel().validOps()) != 0
Throws: CancelledKeyException If this key has been cancelled
Throws: CancelledKeyException If this key has been cancelled
Throws: CancelledKeyException If this key has been cancelled
Throws: CancelledKeyException If this key has been cancelled
Throws: CancelledKeyException If this key has been cancelled