|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exist.util.UTF8
public class UTF8
This class contains two static tools for doing UTF-8 encoding and decoding.
UTF-8 is ASCII- transparent. It supports character sets requiring more than the seven bit ASCII base range of UTF-8, including Unicode, ISO-8859, ISO-10646, etc..
We do not use an ISO UCS code signature, and we do not use a Java Data I/O- style strlen prefix.
Constructor Summary | |
---|---|
UTF8()
|
Method Summary | |
---|---|
static XMLString |
decode(byte[] code)
Decode UTF-8 input, terminates decoding at a null character, value 0x0. |
static XMLString |
decode(byte[] code,
int off,
int many)
|
static XMLString |
decode(byte[] code,
int off,
int many,
XMLString xs)
Decode UTF-8 input, terminates decoding at a null character, value 0x0. |
static byte[] |
encode(char[] str)
Encode string in UTF-8. |
static byte[] |
encode(char[] str,
int start,
int length,
byte[] bytbuf,
int offset)
Encode string in UTF-8. |
static byte[] |
encode(String s)
Encode string in UTF-8. |
static byte[] |
encode(String str,
byte[] bytbuf,
int offset)
|
static byte[] |
encode(String str,
int start,
int length,
byte[] bytbuf,
int offset)
Encode string in UTF-8. |
static int |
encoded(char[] str,
int start,
int len)
Returns the length of the string encoded in UTF-8. |
static int |
encoded(String str)
Returns the length of the string encoded in UTF-8. |
static int |
getUTF8Encoding(char in,
char in2,
byte[] out)
Static method to generate the UTF-8 representation of a Unicode character. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public UTF8()
Method Detail |
---|
public static final XMLString decode(byte[] code)
IllegalStateException
- Bad format.public static final XMLString decode(byte[] code, int off, int many)
public static final XMLString decode(byte[] code, int off, int many, XMLString xs)
IllegalStateException
- Bad format.public static final byte[] encode(char[] str)
public static final byte[] encode(char[] str, int start, int length, byte[] bytbuf, int offset)
public static final byte[] encode(String str, byte[] bytbuf, int offset)
public static final byte[] encode(String str, int start, int length, byte[] bytbuf, int offset)
public static final byte[] encode(String s)
public static final int encoded(String str)
public static final int encoded(char[] str, int start, int len)
public static int getUTF8Encoding(char in, char in2, byte[] out)
in
- the Unicode character, or the high half of a surrogate pairin2
- the low half of a surrogate pair (ignored unless the first argument is in the
range for a surrogate pair)out
- an array of at least 4 bytes to hold the UTF-8 representation.
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |