ByteArrayBuilder

Builds a ByteArray from primary types

Properties

Link copied to clipboard
abstract val byteOrder: ByteOrder

The ByteOrder in which the array is built. If ByteOrder.MOST_SIGNIFICANT_FIRST any elements will be added to the front of the array. This order acts as the default for encoding primary types added to this array.

Functions

Link copied to clipboard
abstract fun add(medFloat16: MedFloat16)

Adds a MedFloat16 to the array.

abstract fun add(medFloat32: MedFloat32)

Adds a MedFloat32 to the array.

abstract fun add(flag: Boolean)

Adds a Boolean to the array. Any subsequent Boolean will be added as the next bit of a byte until the byte is full. If any additional element is added in between, the Boolean containing byte will be added as is.

abstract fun add(byte: Byte)

Adds a single Byte to the array

abstract fun add(bytes: ByteArray)

Adds a ByteArray to the array. The order of this array will be preserved but its position is determined by byteOrder.

abstract fun add(uByte: UByte)

Adds a single UByte to the array

abstract fun add(int24: Int24, order: ByteOrder = byteOrder)

Adds an Int24 to the array, encoded using Int24.toByteArray

abstract fun add(uInt24: UInt24, order: ByteOrder = byteOrder)

Adds a UInt24 to the array, encoded using UInt24.toByteArray

abstract fun add(double: Double, order: ByteOrder = byteOrder)

Adds a Double to the array, encoded using Double.toByteArray

abstract fun add(float: Float, order: ByteOrder = byteOrder)

Adds a Float to the array, encoded using Float.toByteArray

abstract fun add(int: Int, order: ByteOrder = byteOrder)

Adds an Int to the array, encoded using Int.toByteArray

abstract fun add(long: Long, order: ByteOrder = byteOrder)

Adds a Long to the array, encoded using Long.toByteArray

abstract fun add(short: Short, order: ByteOrder = byteOrder)

Adds a Short to the array, encoded using Short.toByteArray

abstract fun add(uInt: UInt, order: ByteOrder = byteOrder)

Adds a UInt to the array, encoded using UInt.toByteArray

abstract fun add(uLong: ULong, order: ByteOrder = byteOrder)

Adds a ULong to the array, encoded using ULong.toByteArray

abstract fun add(uShort: UShort, order: ByteOrder = byteOrder)

Adds a UShort to the array, encoded using UShort.toByteArray

abstract fun add(char: Char, encoding: Encoding = Encoding.UTF_8, order: ByteOrder = byteOrder)

Adds a Char to the array. The char will be encoded using Encoding.encodeChar

abstract fun add(string: String, settings: StringEncodingSettings = StringEncodingSettings(), order: ByteOrder = byteOrder)

Adds a String to the array. The String will be encoded using Encoding.encodeString