final class SelectionKey extends AnyRef
Linear Supertypes
Ordering
- Alphabetic
- By Inheritance
Inherited
- SelectionKey
- AnyRef
- Any
- Hide All
- Show All
Visibility
- Public
- Protected
Instance Constructors
- new SelectionKey(selectionKey: java.nio.channels.SelectionKey)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- final def attach(ob: Option[AnyRef])(implicit trace: Trace): UIO[Option[AnyRef]]
- final def attachment(implicit trace: Trace): UIO[Option[AnyRef]]
- final def cancel(implicit trace: Trace): UIO[Unit]
- def channel: SelectableChannel
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(obj: Any): Boolean
- Definition Classes
- SelectionKey → AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- SelectionKey → AnyRef → Any
- final def interestOps(ops: Set[Operation])(implicit trace: Trace): UIO[Unit]
- final def interestOps(implicit trace: Trace): UIO[Set[Operation]]
- def interested(op: Operation)(implicit trace: Trace): UIO[Set[Operation]]
- final def isAcceptable(implicit trace: Trace): UIO[Boolean]
- final def isConnectable(implicit trace: Trace): UIO[Boolean]
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def isReadable(implicit trace: Trace): UIO[Boolean]
- final def isValid(implicit trace: Trace): UIO[Boolean]
- final def isWritable(implicit trace: Trace): UIO[Boolean]
- def matchChannel[R, E, A](matcher: (Set[Operation]) => PartialFunction[SelectableChannel, ZIO[R, E, A]])(implicit trace: Trace): ZIO[R, E, A]
Convenience method for processing keys from the selected key set.
Convenience method for processing keys from the selected key set.
Pattern matching on the channel type avoids the need for potentially unsafe casting to the channel type you expect.
If a channel type is selected that does not match the pattern match supplied then a defect is raised.
Usage:
for { _ <- selector.select _ <- selector.foreachSelectedKey { key => key.matchChannel { readyOps => { case channel: ServerSocketChannel if readyOps(Operation.Accept) => // use `channel` to accept connection case channel: SocketChannel => ZIO.when(readyOps(Operation.Read)) { // use `channel` to read } *> ZIO.when(readyOps(Operation.Write)) { // use `channel` to write } } } } } yield ()
- matcher
Function that is passed the ready operations set, and must return a partial function that handles whatever channel types are registered with the selector.
- returns
The effect value returned by
matcher
, or a defect value ifmatcher
did not match the selected channel.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def notInterested(op: Operation)(implicit trace: Trace): UIO[Set[Operation]]
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def readyOps(implicit trace: Trace): UIO[Set[Operation]]
- final def selector: Selector
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- SelectionKey → AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()