getUTFRegion

context(env: JniEnv)
fun JString.getUTFRegion(start: Int, len: Int, buf: CArrayPointer<ByteVar>)(source)

Translates len number of Unicode characters beginning at offset start into modified UTF-8 encoding and place the result in the given buffer buf.

The len argument specifies the number of Unicode characters. The resulting number modified UTF-8 encoding characters may be greater than the given len argument. utfLength may be used to determine the maximum size of the required character buffer.

Since this specification does not require the resulting string copy be NULL terminated, it is advisable to clear the given character buffer (e.g. memset()) before using this function to safely perform strlen().

Receiver

a Java string object.

Since

JDK/JRE 1.2

Parameters

start

the index of the first Unicode character in the string to copy. Must be greater than or equal to zero, and less than the string length.

len

the number of Unicode characters to copy. Must be greater than zero and start + len must be less than string length.

buf

the Unicode character buffer into which to copy the string region.

Throws

StringIndexOutOfBoundsException

on index overflow.