|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.nio.channels.SelectionKey
public abstract class SelectionKey
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int OP_ACCEPT
public static final int OP_CONNECT
public static final int OP_READ
public static final int OP_WRITE
Constructor Detail |
---|
protected SelectionKey()
Method Detail |
---|
public final Object attach(Object obj)
public final Object attachment()
public final boolean isAcceptable()
CancelledKeyException
- If this key has been cancelledpublic final boolean isConnectable()
CancelledKeyException
- If this key has been cancelledpublic final boolean isReadable()
CancelledKeyException
- If this key has been cancelledpublic final boolean isWritable()
CancelledKeyException
- If this key has been cancelledpublic abstract void cancel()
public abstract SelectableChannel channel()
public abstract int interestOps()
CancelledKeyException
- If this key has been cancelledpublic abstract SelectionKey interestOps(int ops)
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()) != 0public abstract boolean isValid()
public abstract int readyOps()
CancelledKeyException
- If this key has been cancelledpublic abstract Selector selector()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |