public abstract class UTF8Convert extends Object
| Constructor and Description |
|---|
UTF8Convert() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
check(byte[] bytes)
Check whether the given sequence of bytes is valid (pseudo-)utf8.
|
static String |
fromUTF8(byte[] utf8)
Convert the given sequence of (pseudo-)utf8 formatted bytes into a String.
|
static String |
fromUTF8(ImmutableByteArray s) |
static byte[] |
toUTF8(String s)
Convert the given String into a sequence of (pseudo-)utf8 formatted bytes.
|
static int |
utfLength(String s)
Returns the length of a string's UTF encoded form.
|
public static String fromUTF8(byte[] utf8) throws UTFDataFormatException
utf8 - (pseudo-)utf8 byte arrayUTFDataFormatException - if the (pseudo-)utf8 byte array is not valid (pseudo-)utf8IllegalArgumentException - if utf8 is nullpublic static byte[] toUTF8(String s)
s - String to convertIllegalArgumentException - if s is nullpublic static int utfLength(String s)
IllegalArgumentException - if s is nullpublic static boolean check(byte[] bytes)
bytes - byte array to checkIllegalArgumentException - if bytes is nullpublic static String fromUTF8(ImmutableByteArray s)
Copyright © 2015. All rights reserved.