copyUTF8IntoArray

fun String.copyUTF8IntoArray(array: ByteArray, offset: Int = 0, byteOrder: ByteOrder, throwOnMalformed: Boolean = false): ByteArray

Encodes a String using UTF-8 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 to use.

throwOnMalformed

if true, throws a KalugaCharacterCodingException if the string contains malformed UTF-8.

Throws

if the string contains malformed UTF-8