copyUTF16IntoByteArray

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

Encodes a Char and copies it into a ByteArray at a given offset in UTF-16 using the given ByteOrder.

Return

the ByteArray representing the Char in UTF-16.

Parameters

array

the ByteArray to copy the encoded data into.

offset

the offset at which to copy the encoded data.

byteOrder

the ByteOrder to use.

Throws

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