public final class Utf8Utils extends Object
| Constructor and Description |
|---|
Utf8Utils() |
| Modifier and Type | Method and Description |
|---|---|
static int |
charLength(byte[] data,
int offset,
int length) |
static int |
findLastCharacter(byte[] text,
int from,
int until)
Find the start of the last character that ends in the current string.
|
static int |
getCodePoint(byte[] source,
int from,
int len)
Get the code point at a given location in the byte array.
|
static boolean |
isUtfStartByte(byte b)
Checks if b is the first byte of a UTF-8 character.
|
static int |
truncateBytesTo(int maxCharLength,
byte[] data,
int offset,
int length)
Return the number of bytes required to read at most
maxLength characters in full from a utf-8 encoded byte array provided
by data[offset:offset+length].
|
public static int charLength(byte[] data,
int offset,
int length)
public static int truncateBytesTo(int maxCharLength,
byte[] data,
int offset,
int length)
maxCharLength - data - offset - length - public static boolean isUtfStartByte(byte b)
public static int findLastCharacter(byte[] text,
int from,
int until)
text - the bytes of the utf-8from - the first byte locationuntil - the last byte locationpublic static int getCodePoint(byte[] source,
int from,
int len)
source - the bytes of the stringfrom - the offset to start atlen - the number of bytes in the characterCopyright © 2013–2022 The Apache Software Foundation. All rights reserved.