WithOverflow

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

Constructors

Link copied to clipboard
constructor(sentinel: Byte = 0xFF.toByte())

Properties

Link copied to clipboard

the sentinel to indicate length was encoded as a short

Functions

Link copied to clipboard
open override 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
open override fun expectedByteSize(size: UInt): Int

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