Utf8

object Utf8

Functions

Link copied to clipboard
fun codePointAt(seq: CharSequence, position: Int): Int
Link copied to clipboard
fun decodeUtf8Array(bytes: ByteArray, index: Int = 0, size: Int = bytes.size): String
Link copied to clipboard
fun decodeUtf8CodePoint(bytes: ReadBuffer, index: Int, out: CharArray)
Link copied to clipboard

Returns the number of bytes in the UTF-8-encoded form of sequence. For a string, this method is equivalent to string.getBytes(UTF_8).length, but is more efficient in both time and space.

Link copied to clipboard
fun encodeUtf8Array(input: CharSequence, out: ByteArray, offset: Int = 0, length: Int = out.size - offset): Int
Link copied to clipboard
fun encodeUtf8CodePoint(input: CharSequence, start: Int, out: ByteArray): Int

Encode a CharSequence UTF8 codepoint into a byte array.

Link copied to clipboard
fun handleFourBytes(byte1: Byte, byte2: Byte, byte3: Byte, byte4: Byte, resultArr: CharArray, resultPos: Int)
Link copied to clipboard
fun handleOneByte(byte1: Byte, resultArr: CharArray, resultPos: Int)
Link copied to clipboard
fun handleThreeBytes(byte1: Byte, byte2: Byte, byte3: Byte, resultArr: CharArray, resultPos: Int)
Link copied to clipboard
fun handleTwoBytes(byte1: Byte, byte2: Byte, resultArr: CharArray, resultPos: Int)
Link copied to clipboard
inline fun isFourByte(b: Byte): Boolean

Returns whether this is a four-byte codepoint with the form 11110xxx 0xF0..0xF4.

Link copied to clipboard
inline fun isOneByte(b: Byte): Boolean

Returns whether this is a single-byte codepoint (i.e., ASCII) with the form '0XXXXXXX'.

Link copied to clipboard
inline fun isThreeBytes(b: Byte): Boolean

Returns whether this is a three-byte codepoint with the form 1110xxxx 0xE0..0xEF.

Link copied to clipboard
inline fun isTwoBytes(b: Byte): Boolean

Returns whether this is a two-byte codepoint with the form 110xxxxx 0xC0..0xDF.