Skip to content

FrameDecoder[A: Any val]

[Source]

Wraps any Codec[A] for use with TCP stream framing.

Incoming iso chunks are concatenated with any unconsumed remainder into a val buffer for decoding. Decoded byte slices are zero-copy views into that buffer. After the decode loop, the unconsumed tail is kept as a zero-copy trim for the next call.

InsufficientData means "wait for more bytes" — normal in streaming. MalformedData means "this data is wrong" — reported as an error via FrameNotify.frame_error.

class ref FrameDecoder[A: Any val]

Constructors

create

[Source]

new ref create(
  codec: Codec[A] val)
: FrameDecoder[A] ref^

Parameters

Returns


Public Functions

received

[Source]

Append a chunk of incoming data and extract all complete messages.

fun ref received(
  data: Array[U8 val] iso,
  notify: FrameNotify[A] ref)
: None val

Parameters

Returns