ByteToObjectStage

trait ByteToObjectStage[O] extends MidStage[ByteBuffer, O]
trait MidStage[ByteBuffer, O]
trait Head[O]
trait Tail[ByteBuffer]
trait Stage
class Object
trait Matchable
class Any

Value members

Abstract methods

def bufferToMessage(in: ByteBuffer): Option[O]

Method that decodes ByteBuffers to objects. None reflects not enough data to decode a message Any unused data in the ByteBuffer will be recycled and available for the next read.

Method that decodes ByteBuffers to objects. None reflects not enough data to decode a message Any unused data in the ByteBuffer will be recycled and available for the next read.

WARNING: don't count on the underlying array of the ByteBuffer. This uses the slice method, which could preserve access to the buffer, but mess with the various positions.

Value Params
in

ByteBuffer of immediately available data

Returns

optional message if enough data was available

def messageToBuffer(in: O): Seq[ByteBuffer]

Encode objects to buffers

Encode objects to buffers

Value Params
in

object to decode

Returns

sequence of ByteBuffers to pass to the head

Concrete methods

def readRequest(size: Int): Future[O]
override def writeRequest(data: Seq[O]): Future[Unit]
Definition Classes
def writeRequest(data: O): Future[Unit]

Inherited methods

def channelRead(size: Int, timeout: Duration): Future[ByteBuffer]
Inherited from
Tail
final def channelWrite(data: Seq[ByteBuffer], timeout: Duration): Future[Unit]

Write a collection of outbound messages to the pipeline with a timeout

Write a collection of outbound messages to the pipeline with a timeout

Inherited from
Tail
def channelWrite(data: Seq[ByteBuffer]): Future[Unit]

Write a collection of outbound messages to the pipeline

Write a collection of outbound messages to the pipeline

Inherited from
Tail
final def channelWrite(data: ByteBuffer, timeout: Duration): Future[Unit]

Write a single outbound message to the pipeline with a timeout

Write a single outbound message to the pipeline with a timeout

Inherited from
Tail
def channelWrite(data: ByteBuffer): Future[Unit]

Write a single outbound message to the pipeline

Write a single outbound message to the pipeline

Inherited from
Tail
final def closePipeline(cause: Option[Throwable]): Unit
Inherited from
Tail
final def findInboundStage[C <: Stage](clazz: Class[C]): Option[C]

Find the next inbound Stage of type C, if it exists.

Find the next inbound Stage of type C, if it exists.

Inherited from
Head
final def findInboundStage(name: String): Option[Stage]

Find the next outbound Stage with the given name, if it exists.

Find the next outbound Stage with the given name, if it exists.

Inherited from
Head
final def findOutboundStage[C <: Stage](clazz: Class[C]): Option[C]

Find the next outbound Stage of type C, if it exists.

Find the next outbound Stage of type C, if it exists.

Inherited from
Tail
final def findOutboundStage(name: String): Option[Stage]

Find the next outbound Stage with the given name, if it exists.

Find the next outbound Stage with the given name, if it exists.

Inherited from
Tail
override def inboundCommand(cmd: InboundCommand): Unit

Receives inbound commands Override to capture commands.

Receives inbound commands Override to capture commands.

Definition Classes
Inherited from
Head
def name: String
Inherited from
Stage
final def removeStage(ev: MidStage[ByteBuffer, O] =:= MidStage[ByteBuffer, ByteBuffer]): Unit

Remove this MidStage from the pipeline

Remove this MidStage from the pipeline

Inherited from
MidStage
final def replaceInline(stage: MidStage[ByteBuffer, O]): ByteToObjectStage[O]

Replace this MidStage with the provided MidStage of the same type

Replace this MidStage with the provided MidStage of the same type

Inherited from
MidStage
final def replaceNext(stage: LeafBuilder[O], startup: Boolean): Tail[O]

Replace all remaining inbound Stages of the pipeline, not including this Stage.

Replace all remaining inbound Stages of the pipeline, not including this Stage.

Inherited from
Head
final def replaceTail(leafBuilder: LeafBuilder[ByteBuffer], startup: Boolean): ByteToObjectStage[O]

Replace all downstream Stages, including this Stage.

Replace all downstream Stages, including this Stage.

If this was a MidStage, its inbound element is notified via a Disconnected Command.

Inherited from
Tail
final def sendInboundCommand(cmd: InboundCommand): Unit

Send a command to the next inbound Stage of the pipeline

Send a command to the next inbound Stage of the pipeline

Inherited from
Head
final def spliceAfter(stage: MidStage[O, O]): Unit

Insert the MidStage after this

Insert the MidStage after this

Inherited from
Head
final def spliceBefore(stage: MidStage[ByteBuffer, ByteBuffer]): Unit

Insert the MidStage before this Stage

Insert the MidStage before this Stage

Inherited from
Tail
protected def stageShutdown(): Unit

Shuts down the stage, deallocating resources, etc.

Shuts down the stage, deallocating resources, etc.

It will be called when the stage receives a Disconnected command unless inboundCommand is overridden. This method should not send or Disconnected commands.

It is possible that this will not be called due to failure of other stages to propagate shutdown commands. Conversely, it is also possible for this to be called more than once due to the reception of multiple shutdown commands. It is therefore recommended that the method be idempotent.

Inherited from
Stage
protected def stageStartup(): Unit

Start the stage, allocating resources etc.

Start the stage, allocating resources etc.

This method should not effect other stages by sending commands etc unless it creates them. It is not impossible that the stage will receive other commands besides Connected before this method is called. It is not impossible for this method to be called multiple times by misbehaving stages. It is therefore recommended that the method be idempotent.

Inherited from
Stage

Abstract fields

val maxBufferSize: Int

Inherited fields

final protected val logger: Logger
Inherited from
Stage