toUTF8

fun String.toUTF8(byteOrder: ByteOrder, throwOnMalformed: Boolean = false): ByteArray

Encodes a String to a ByteArray using UTF-8.

Return

The encoded ByteArray

Parameters

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