java.nio.channels
Class SelectionKey
java.lang.Object
|
+--java.nio.channels.SelectionKey
public abstract class
SelectionKeyextends
Object Since:Author:OP_ACCEPT
public static final int OP_ACCEPT
Since:Author:
OP_CONNECT
public static final int OP_CONNECT
OP_READ
public static final int OP_READ
OP_WRITE
public static final int OP_WRITE
SelectionKey
protected SelectionKey()
Initializes the selection key.
attach
public final Object attach(java.lang.Object obj)
Attaches obj to the key and returns the old attached object.
Parameters:
attachment
public final Object attachment()
Returns the object attached to the key.
cancel
public void cancel()
Requests that the registration of this key's channel with
its selector be cancelled.
channel
public SelectableChannel channel()
return the channel attached to the key.
interestOps
public int interestOps()
Returns the key's interest set.
Throws:
interestOps
public SelectionKey interestOps(int ops)
Sets this key's interest set to the given value.
Parameters:
Throws:
isAcceptable
public final boolean isAcceptable()
Tests if the channel attached to this key is ready to accept
a new socket connection.
Throws:
isConnectable
public final boolean isConnectable()
Tests whether this key's channel has either finished,
or failed to finish, its socket-connection operation.
Throws:
isReadable
public final boolean isReadable()
Tests if the channel attached to the key is readable.
Throws:
isValid
public boolean isValid()
Tells whether or not this key is valid.
isWritable
public final boolean isWritable()
Tests if the channel attached to the key is writable.
Throws:
readyOps
public int readyOps()
Retrieves this key's ready-operation set.
Throws:
selector
public Selector selector()
Returns the selector for which this key was created.