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]): UIO[Option[AnyRef]]
- final def attachment: UIO[Option[AnyRef]]
- final def cancel: 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]): UIO[Unit]
- final def interestOps: UIO[Set[Operation]]
- def interested(op: Operation): UIO[Set[Operation]]
- final def isAcceptable: UIO[Boolean]
- final def isConnectable: UIO[Boolean]
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def isReadable: UIO[Boolean]
- final def isValid: UIO[Boolean]
- final def isWritable: UIO[Boolean]
- def matchChannel[R, E, A](matcher: (Set[Operation]) => PartialFunction[SelectableChannel, ZIO[R, E, A]]): 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 => IO.when(readyOps(Operation.Read)) { // use `channel` to read } *> IO.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 ifmatcherdid not match the selected channel.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def notInterested(op: Operation): UIO[Set[Operation]]
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def readyOps: 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()