Package java.nio.channels.spi
Class AbstractSelectionKey
- java.lang.Object
-
- java.nio.channels.SelectionKey
-
- java.nio.channels.spi.AbstractSelectionKey
-
public abstract class AbstractSelectionKey extends SelectionKey
AbstractSelectionKeyis the base implementation class for selection keys. It implements validation and cancellation methods.
-
-
Field Summary
-
Fields inherited from class java.nio.channels.SelectionKey
OP_ACCEPT, OP_CONNECT, OP_READ, OP_WRITE
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractSelectionKey()Constructs a newAbstractSelectionKey.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()Cancels this key.booleanisValid()Indicates whether this key is valid.-
Methods inherited from class java.nio.channels.SelectionKey
attach, attachment, channel, interestOps, interestOps, isAcceptable, isConnectable, isReadable, isWritable, readyOps, selector
-
-
-
-
Method Detail
-
isValid
public final boolean isValid()
Indicates whether this key is valid. A key is valid as long as it has not been canceled.- Specified by:
isValidin classSelectionKey- Returns:
trueif this key has not been canceled,falseotherwise.
-
cancel
public final void cancel()
Cancels this key.A key that has been canceled is no longer valid. Calling this method on an already canceled key does nothing.
- Specified by:
cancelin classSelectionKey
-
-