LengthPrefixFramer

class LengthPrefixFramer(maxFrameSize: Int = DEFAULT_MAX_FRAME_SIZE) : Framer

Length-prefix framing: each frame is [length: uint32 LE][payload: bytes].

Length is the payload size, not including the 4-byte header. Frames larger than maxFrameSize cause Unframer.feed to throw FrameTooLargeException to prevent unbounded buffering by a hostile peer.

The default cap is 64 KiB, deliberately small for BLE-scale workloads where a single frame typically encodes one event. Raise it explicitly when a use case demands larger payloads.

Constructors

Link copied to clipboard
constructor(maxFrameSize: Int = DEFAULT_MAX_FRAME_SIZE)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun frame(payload: ByteArray): ByteArray
Link copied to clipboard
open override fun unframer(): Unframer