FixedSizeFrameParser

class FixedSizeFrameParser(frameSize: Int, header: ByteArray = byteArrayOf(), footer: ByteArray = byteArrayOf()) : FrameParser(source)

Compatible with legacy implementation: looks for an optional header, extracts fixed-size frames and validates an optional footer.

Parameters

frameSize

The fixed size of each frame in bytes

header

Optional header bytes that must precede each frame

footer

Optional footer bytes that must follow each frame

Constructors

Link copied to clipboard
constructor(frameSize: Int, header: ByteArray = byteArrayOf(), footer: ByteArray = byteArrayOf())

Functions

Link copied to clipboard
open override fun appendAndExtract(data: ByteArray): List<ByteArray>

Append incoming bytes and return a list of complete frames extracted.

Link copied to clipboard
open override fun reset()

Clear internal state.