Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.nio.channels
Class SelectionKey  view SelectionKey download SelectionKey.java

java.lang.Object
  extended byjava.nio.channels.SelectionKey

public abstract class SelectionKey
extends java.lang.Object

Since:
1.4

Field Summary
(package private)  java.lang.Object attached
           
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
 java.lang.Object attach(java.lang.Object obj)
          Attaches obj to the key and returns the old attached object.
 java.lang.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

OP_ACCEPT

public static final int OP_ACCEPT
See Also:
Constant Field Values

OP_CONNECT

public static final int OP_CONNECT
See Also:
Constant Field Values

OP_READ

public static final int OP_READ
See Also:
Constant Field Values

OP_WRITE

public static final int OP_WRITE
See Also:
Constant Field Values

attached

java.lang.Object attached
Constructor Detail

SelectionKey

protected SelectionKey()
Initializes the selection key.

Method Detail

attach

public final java.lang.Object attach(java.lang.Object obj)
Attaches obj to the key and returns the old attached object.


attachment

public final java.lang.Object attachment()
Returns the object attached to the key.


isAcceptable

public final boolean isAcceptable()
Tests if the channel attached to this key is ready to accept a new socket connection.


isConnectable

public final boolean isConnectable()
Tests whether this key's channel has either finished, or failed to finish, its socket-connection operation.


isReadable

public final boolean isReadable()
Tests if the channel attached to the key is readable.


isWritable

public final boolean isWritable()
Tests if the channel attached to the key is writable.


cancel

public abstract void cancel()
Requests that the registration of this key's channel with its selector be cancelled.


channel

public abstract SelectableChannel channel()
return the channel attached to the key.


interestOps

public abstract int interestOps()
Returns the key's interest set.


interestOps

public abstract SelectionKey interestOps(int ops)
Sets this key's interest set to the given value.


isValid

public abstract boolean isValid()
Tells whether or not this key is valid.


readyOps

public abstract int readyOps()
Retrieves this key's ready-operation set.


selector

public abstract Selector selector()
Returns the selector for which this key was created.