copyCharIntoByteArray

fun Encoding.copyCharIntoByteArray(char: Char, array: ByteArray, offset: Int = 0, byteOrder: ByteOrder): ByteArray

Encodes a Char using the given Encoding and ByteOrder and copies it into a ByteArray at a given offset.

Return

the encoded ByteArray.

Parameters

char

the Char to encode.

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 Char is encoded. For Encoding where Encoding.byteSize is 1, this can be ignored.

Throws

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