public final SelectionKey register (Selector sel, int ops) throws ClosedChannelException

Registers this channel with the given selector, returning a selection key.

An invocation of this convenience method of the form

sc.register(sel, ops)
behaves in exactly the same way as the invocation
sc.register(java.nio.channels.Selector,int,java.lang.Object)(sel, ops, null)

sel     The selector with which this channel is to be registered
ops     The interest set for the resulting key

Returns:  A key representing the registration of this channel with the given selector

ClosedChannelException     If this channel is closed
ClosedSelectorException     If the selector is closed
IllegalBlockingModeException     If this channel is in blocking mode
IllegalSelectorException     If this channel was not created by the same provider as the given selector
CancelledKeyException     If this channel is currently registered with the given selector but the corresponding key has already been cancelled
IllegalArgumentException     If a bit in ops does not correspond to an operation that is supported by this channel, that is, if set & ~validOps() != 0