java.nio.channels.spi
Class AbstractSelectionKey

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.nio.channels.SelectionKey sample code for java.nio.channels.SelectionKey definition code for java.nio.channels.SelectionKey 
      extended by java.nio.channels.spi.AbstractSelectionKey

public abstract class AbstractSelectionKey
extends SelectionKey sample code for java.nio.channels.SelectionKey definition code for java.nio.channels.SelectionKey

Base implementation class for selection keys.

This class tracks the validity of the key and implements cancellation.

Since:
1.4

Field Summary
 
Fields inherited from class java.nio.channels.SelectionKey sample code for java.nio.channels.SelectionKey definition code for java.nio.channels.SelectionKey
OP_ACCEPT sample code for java.nio.channels.SelectionKey.OP_ACCEPT definition code for java.nio.channels.SelectionKey.OP_ACCEPT , OP_CONNECT sample code for java.nio.channels.SelectionKey.OP_CONNECT definition code for java.nio.channels.SelectionKey.OP_CONNECT , OP_READ sample code for java.nio.channels.SelectionKey.OP_READ definition code for java.nio.channels.SelectionKey.OP_READ , OP_WRITE sample code for java.nio.channels.SelectionKey.OP_WRITE definition code for java.nio.channels.SelectionKey.OP_WRITE
 
Constructor Summary
protected AbstractSelectionKey sample code for java.nio.channels.spi.AbstractSelectionKey.AbstractSelectionKey() definition code for java.nio.channels.spi.AbstractSelectionKey.AbstractSelectionKey() ()
          Initializes a new instance of this class.
 
Method Summary
 void cancel sample code for java.nio.channels.spi.AbstractSelectionKey.cancel() definition code for java.nio.channels.spi.AbstractSelectionKey.cancel() ()
          Cancels this key.
 boolean isValid sample code for java.nio.channels.spi.AbstractSelectionKey.isValid() definition code for java.nio.channels.spi.AbstractSelectionKey.isValid() ()
          Tells whether or not this key is valid.
 
Methods inherited from class java.nio.channels.SelectionKey sample code for java.nio.channels.SelectionKey definition code for java.nio.channels.SelectionKey
attach sample code for java.nio.channels.SelectionKey.attach(java.lang.Object) definition code for java.nio.channels.SelectionKey.attach(java.lang.Object) , attachment sample code for java.nio.channels.SelectionKey.attachment() definition code for java.nio.channels.SelectionKey.attachment() , channel sample code for java.nio.channels.SelectionKey.channel() definition code for java.nio.channels.SelectionKey.channel() , interestOps sample code for java.nio.channels.SelectionKey.interestOps() definition code for java.nio.channels.SelectionKey.interestOps() , interestOps sample code for java.nio.channels.SelectionKey.interestOps(int) definition code for java.nio.channels.SelectionKey.interestOps(int) , isAcceptable sample code for java.nio.channels.SelectionKey.isAcceptable() definition code for java.nio.channels.SelectionKey.isAcceptable() , isConnectable sample code for java.nio.channels.SelectionKey.isConnectable() definition code for java.nio.channels.SelectionKey.isConnectable() , isReadable sample code for java.nio.channels.SelectionKey.isReadable() definition code for java.nio.channels.SelectionKey.isReadable() , isWritable sample code for java.nio.channels.SelectionKey.isWritable() definition code for java.nio.channels.SelectionKey.isWritable() , readyOps sample code for java.nio.channels.SelectionKey.readyOps() definition code for java.nio.channels.SelectionKey.readyOps() , selector sample code for java.nio.channels.SelectionKey.selector() definition code for java.nio.channels.SelectionKey.selector()
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

AbstractSelectionKey sample code for java.nio.channels.spi.AbstractSelectionKey() definition code for java.nio.channels.spi.AbstractSelectionKey()

protected AbstractSelectionKey()
Initializes a new instance of this class.

Method Detail

isValid sample code for java.nio.channels.spi.AbstractSelectionKey.isValid() definition code for java.nio.channels.spi.AbstractSelectionKey.isValid()

public final boolean isValid()
Description copied from class: SelectionKey sample code for java.nio.channels.SelectionKey.isValid() definition code for java.nio.channels.SelectionKey.isValid()
Tells whether or not this key is valid.

A key is valid upon creation and remains so until it is cancelled, its channel is closed, or its selector is closed.

Specified by:
isValid sample code for java.nio.channels.SelectionKey.isValid() definition code for java.nio.channels.SelectionKey.isValid() in class SelectionKey sample code for java.nio.channels.SelectionKey definition code for java.nio.channels.SelectionKey
Returns:
true if, and only if, this key is valid

cancel sample code for java.nio.channels.spi.AbstractSelectionKey.cancel() definition code for java.nio.channels.spi.AbstractSelectionKey.cancel()

public final void cancel()
Cancels this key.

If this key has not yet been cancelled then it is added to its selector's cancelled-key set while synchronized on that set.

Specified by:
cancel sample code for java.nio.channels.SelectionKey.cancel() definition code for java.nio.channels.SelectionKey.cancel() in class SelectionKey sample code for java.nio.channels.SelectionKey definition code for java.nio.channels.SelectionKey