UTF16toUTF8

fun UTF16toUTF8(s: CharSequence, offset: Int, length: Int, out: ByteArray): Int

Encode characters from this String, starting at offset for length characters. It is the responsibility of the caller to make sure that the destination array is large enough.


fun UTF16toUTF8(source: CharArray, offset: Int, length: Int, out: ByteArray): Int

Encode characters from a char[] source, starting at offset for length chars. It is the responsibility of the caller to make sure that the destination array is large enough.


fun UTF16toUTF8(s: CharSequence, offset: Int, length: Int, out: ByteArray, outOffset: Int): Int

Encode characters from this String, starting at offset for length characters. Output to the destination array will begin at outOffset. It is the responsibility of the caller to make sure that the destination array is large enough.

note this method returns the final output offset (outOffset + number of bytes written)