LengthPrefix

An EndMarking where the length of the String is encoded as a prefix.

Inheritors

Types

Link copied to clipboard

A LengthPrefix where the size is always encoded as a single UByte

Link copied to clipboard

A LengthPrefix where the size is always encoded as an UShort

Link copied to clipboard
data class WithOverflow(val sentinel: Byte = 0xFF.toByte()) : StringEncodingSettings.LengthPrefix

A LengthPrefix where the size is encoded as an UByte if it fits, or using a sentinel prefix followed by a UShort length

Functions

Link copied to clipboard
abstract fun copyEncodedSizeInto(array: ByteArray, size: UInt, order: ByteOrder, offset: Int): ByteArray

Encodes the length of the String as a prefix and copies it into a ByteArray at a given offset.

Link copied to clipboard
fun encodeSize(size: UInt, order: ByteOrder): ByteArray

Encodes the length of the String as a prefix.

Link copied to clipboard
abstract fun expectedByteSize(size: UInt): Int

The expected number of Bytes required to encode the length of the String.