public final class Unicode extends Object
| Modifier and Type | Field and Description |
|---|---|
private static int |
CHAR_FIVE_BYTES_MASK |
private static int |
CHAR_FOUR_BYTES_MASK |
private static int |
CHAR_ONE_BYTE_MASK |
private static int |
CHAR_SIX_BYTES_MASK |
private static int |
CHAR_THREE_BYTES_MASK |
private static int |
CHAR_TWO_BYTES_MASK |
private static boolean[] |
UNICODE_SUBSET
%01-%27 %2B-%5B %5D-%7F
|
private static int |
UTF8_FIVE_BYTES |
private static int |
UTF8_FIVE_BYTES_MASK |
private static int |
UTF8_FOUR_BYTES |
private static int |
UTF8_FOUR_BYTES_MASK |
private static int |
UTF8_MULTI_BYTES_MASK |
private static int |
UTF8_SIX_BYTES |
private static int |
UTF8_SIX_BYTES_MASK |
private static int |
UTF8_THREE_BYTES |
private static int |
UTF8_THREE_BYTES_MASK |
private static int |
UTF8_TWO_BYTES |
private static int |
UTF8_TWO_BYTES_MASK |
| Modifier | Constructor and Description |
|---|---|
private |
Unicode() |
| Modifier and Type | Method and Description |
|---|---|
static char |
bytesToChar(byte[] bytes)
Return the Unicode char which is coded in the bytes at position 0.
|
static char |
bytesToChar(byte[] bytes,
int pos)
Return the Unicode char which is coded in the bytes at the given
position.
|
static byte[] |
charToBytes(char car)
Return the Unicode char which is coded in the bytes at the given
position.
|
static int |
countBytes(char[] chars)
Count the number of bytes included in the given char[].
|
static int |
countBytesPerChar(byte[] bytes,
int pos)
Count the number of bytes needed to return an Unicode char.
|
static int |
countChars(byte[] bytes)
Count the number of chars included in the given byte[].
|
static int |
countNbBytesPerChar(char car)
Return the number of bytes that hold an Unicode char.
|
static boolean |
isUnicodeSubset(byte b)
Check if the current byte is in the unicodeSubset : all chars but
'\0', '(', ')', '*' and '\'
|
static boolean |
isUnicodeSubset(char c)
Check if the current char is in the unicodeSubset : all chars but
'\0', '(', ')', '*' and '\'
|
static boolean |
isUnicodeSubset(String str,
int pos)
Check if the current char is in the unicodeSubset : all chars but
'\0', '(', ')', '*' and '\'
|
static String |
readUTF(ObjectInput objectInput)
Reads in a string that has been encoded using a modified UTF-8 format.
|
static void |
writeUTF(ObjectOutput objectOutput,
String str)
Writes four bytes of length information to the output stream, followed by the modified UTF-8 representation
of every character in the string str.
|
private static final int UTF8_MULTI_BYTES_MASK
private static final int UTF8_TWO_BYTES_MASK
private static final int UTF8_TWO_BYTES
private static final int UTF8_THREE_BYTES_MASK
private static final int UTF8_THREE_BYTES
private static final int UTF8_FOUR_BYTES_MASK
private static final int UTF8_FOUR_BYTES
private static final int UTF8_FIVE_BYTES_MASK
private static final int UTF8_FIVE_BYTES
private static final int UTF8_SIX_BYTES_MASK
private static final int UTF8_SIX_BYTES
private static final boolean[] UNICODE_SUBSET
private static final int CHAR_ONE_BYTE_MASK
private static final int CHAR_TWO_BYTES_MASK
private static final int CHAR_THREE_BYTES_MASK
private static final int CHAR_FOUR_BYTES_MASK
private static final int CHAR_FIVE_BYTES_MASK
private static final int CHAR_SIX_BYTES_MASK
public static int countBytesPerChar(byte[] bytes,
int pos)
bytes - The bytes to readpos - Position to start counting. It must be a valid start of a
encoded char !public static char bytesToChar(byte[] bytes)
bytes - The byte[] represntation of an Unicode string.public static char bytesToChar(byte[] bytes,
int pos)
bytes - The byte[] represntation of an Unicode string.pos - The current position to start decoding the charpublic static int countNbBytesPerChar(char car)
car - The character to be decodedpublic static int countBytes(char[] chars)
chars - The char array to decodepublic static int countChars(byte[] bytes)
bytes - The byte array to decodepublic static byte[] charToBytes(char car)
car - The character to be transformed to an array of bytespublic static boolean isUnicodeSubset(String str, int pos)
str - The string to checkpos - Position of the current charpublic static boolean isUnicodeSubset(char c)
c - The char to checkpublic static boolean isUnicodeSubset(byte b)
b - The byte to checkpublic static void writeUTF(ObjectOutput objectOutput, String str) throws IOException
DataOutput.writeUTF(String).objectOutput - The objectOutput to write tostr - The value to writeIOException - If the value can't be written to the filepublic static String readUTF(ObjectInput objectInput) throws IOException
DataInput.readUTF().objectInput - The objectInput to read fromIOException - If the value can't be readCopyright © 2003–2017 The Apache Software Foundation. All rights reserved.