copyIntoByteArray

fun Double.copyIntoByteArray(array: ByteArray, offset: Int = 0, byteOrder: ByteOrder): ByteArray

Encodes this Double and copies it into a ByteArray at a given offset.

Return

the encoded ByteArray.

Parameters

array

the ByteArray to copy the encoded data into.

offset

the offset at which to copy the encoded data.

byteOrder

the ByteOrder in which the Double is encoded

Throws

if array is not is not large enough to hold 8 bytes at the offset.


fun Float.copyIntoByteArray(array: ByteArray, offset: Int = 0, byteOrder: ByteOrder): ByteArray

Encodes this Float and copies it into a ByteArray at a given offset.

Return

the encoded ByteArray.

Parameters

array

the ByteArray to copy the encoded data into.

offset

the offset at which to copy the encoded data.

byteOrder

the ByteOrder in which the Float is encoded

Throws

if array is not is not large enough to hold 4 bytes at the offset.


fun Int24.copyIntoByteArray(array: ByteArray, offset: Int = 0, byteOrder: ByteOrder): ByteArray

Encodes this Int24 and copies it into a ByteArray at a given offset.

Return

the encoded ByteArray.

Parameters

array

the ByteArray to copy the encoded data into.

offset

the offset at which to copy the encoded data.

byteOrder

the ByteOrder in which the Int24 is encoded

Throws

if array is not is not large enough to hold 3 bytes at the offset.


fun Int.copyIntoByteArray(array: ByteArray, offset: Int = 0, byteOrder: ByteOrder): ByteArray

Encodes this Int and copies it into a ByteArray at a given offset.

Return

the encoded ByteArray.

Parameters

array

the ByteArray to copy the encoded data into.

offset

the offset at which to copy the encoded data.

byteOrder

the ByteOrder in which the Int is encoded

Throws

if array is not is not large enough to hold 4 bytes at the offset.


fun Long.copyIntoByteArray(array: ByteArray, offset: Int = 0, byteOrder: ByteOrder): ByteArray

Encodes this Long and copies it into a ByteArray at a given offset.

Return

the encoded ByteArray.

Parameters

array

the ByteArray to copy the encoded data into.

offset

the offset at which to copy the encoded data.

byteOrder

the ByteOrder in which the Long is encoded

Throws

if array is not is not large enough to hold 8 bytes at the offset.


Encodes this MedFloat16 and copies it into a ByteArray at a given offset.

Return

the encoded ByteArray.

Parameters

array

the ByteArray to copy the encoded data into.

offset

the offset at which to copy the encoded data.

Throws

if array is not is not large enough to hold 2 bytes at the offset.


Encodes this MedFloat32 and copies it into a ByteArray at a given offset.

Return

the encoded ByteArray.

Parameters

array

the ByteArray to copy the encoded data into.

offset

the offset at which to copy the encoded data.

Throws

if array is not is not large enough to hold 4 bytes at the offset.


fun Short.copyIntoByteArray(array: ByteArray, offset: Int = 0, byteOrder: ByteOrder): ByteArray

Encodes this Short and copies it into a ByteArray at a given offset.

Return

the encoded ByteArray.

Parameters

array

the ByteArray to copy the encoded data into.

offset

the offset at which to copy the encoded data.

byteOrder

the ByteOrder in which the Short is encoded

Throws

if array is not is not large enough to hold 2 bytes at the offset.


fun UInt24.copyIntoByteArray(array: ByteArray, offset: Int = 0, byteOrder: ByteOrder): ByteArray

Encodes this UInt24 and copies it into a ByteArray at a given offset.

Return

the encoded ByteArray.

Parameters

array

the ByteArray to copy the encoded data into.

offset

the offset at which to copy the encoded data.

byteOrder

the ByteOrder in which the UInt24 is encoded

Throws

if array is not is not large enough to hold 3 bytes at the offset.


fun UInt.copyIntoByteArray(array: ByteArray, offset: Int = 0, byteOrder: ByteOrder): ByteArray

Encodes this UInt and copies it into a ByteArray at a given offset.

Return

the encoded ByteArray.

Parameters

array

the ByteArray to copy the encoded data into.

offset

the offset at which to copy the encoded data.

byteOrder

the ByteOrder in which the UInt is encoded

Throws

if array is not is not large enough to hold 4 bytes at the offset.


fun ULong.copyIntoByteArray(array: ByteArray, offset: Int = 0, byteOrder: ByteOrder): ByteArray

Encodes this ULong and copies it into a ByteArray at a given offset.

Return

the encoded ByteArray.

Parameters

array

the ByteArray to copy the encoded data into.

offset

the offset at which to copy the encoded data.

byteOrder

the ByteOrder in which the ULong is encoded

Throws

if array is not is not large enough to hold 8 bytes at the offset.


fun UShort.copyIntoByteArray(array: ByteArray, offset: Int = 0, byteOrder: ByteOrder): ByteArray

Encodes this UShort and copies it into a ByteArray at a given offset.

Return

the encoded ByteArray.

Parameters

array

the ByteArray to copy the encoded data into.

offset

the offset at which to copy the encoded data.

byteOrder

the ByteOrder in which the UShort is encoded

Throws

if array is not is not large enough to hold 2 bytes at the offset.