Package com.ibm.icu.impl
Class Punycode
- java.lang.Object
-
- com.ibm.icu.impl.Punycode
-
public final class Punycode extends java.lang.Object
Ported code from ICU punycode.c
-
-
Field Summary
Fields Modifier and Type Field Description private static int
BASE
private static int
CAPITAL_A
private static int
CAPITAL_Z
private static int
DAMP
private static int
DECODE_MAX_CHARS
private static char
DELIMITER
private static int
ENCODE_MAX_CODE_UNITS
private static char
HYPHEN
private static int
INITIAL_BIAS
private static int
INITIAL_N
private static int
SKEW
private static int
SMALL_A
private static int
SMALL_Z
private static int
TMAX
private static int
TMIN
private static int
ZERO
-
Constructor Summary
Constructors Constructor Description Punycode()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static int
adaptBias(int delta, int length, boolean firstTime)
private static char
asciiCaseMap(char b, boolean uppercase)
static java.lang.StringBuilder
decode(java.lang.CharSequence src, boolean[] caseFlags)
Converts Punycode to Unicode.private static int
decodeDigit(int cp)
private static char
digitToBasic(int digit, boolean uppercase)
digitToBasic() returns the basic code point whose value (when used for representing integers) is d, which must be in the range 0 to BASE-1.static java.lang.StringBuilder
encode(java.lang.CharSequence src, boolean[] caseFlags)
Converts Unicode to Punycode.private static boolean
isBasic(int ch)
private static boolean
isBasicUpperCase(int ch)
private static boolean
isSurrogate(int ch)
-
-
-
Field Detail
-
BASE
private static final int BASE
- See Also:
- Constant Field Values
-
TMIN
private static final int TMIN
- See Also:
- Constant Field Values
-
TMAX
private static final int TMAX
- See Also:
- Constant Field Values
-
SKEW
private static final int SKEW
- See Also:
- Constant Field Values
-
DAMP
private static final int DAMP
- See Also:
- Constant Field Values
-
INITIAL_BIAS
private static final int INITIAL_BIAS
- See Also:
- Constant Field Values
-
INITIAL_N
private static final int INITIAL_N
- See Also:
- Constant Field Values
-
HYPHEN
private static final char HYPHEN
- See Also:
- Constant Field Values
-
DELIMITER
private static final char DELIMITER
- See Also:
- Constant Field Values
-
ZERO
private static final int ZERO
- See Also:
- Constant Field Values
-
SMALL_A
private static final int SMALL_A
- See Also:
- Constant Field Values
-
SMALL_Z
private static final int SMALL_Z
- See Also:
- Constant Field Values
-
CAPITAL_A
private static final int CAPITAL_A
- See Also:
- Constant Field Values
-
CAPITAL_Z
private static final int CAPITAL_Z
- See Also:
- Constant Field Values
-
ENCODE_MAX_CODE_UNITS
private static final int ENCODE_MAX_CODE_UNITS
- See Also:
- Constant Field Values
-
DECODE_MAX_CHARS
private static final int DECODE_MAX_CHARS
- See Also:
- Constant Field Values
-
-
Method Detail
-
adaptBias
private static int adaptBias(int delta, int length, boolean firstTime)
-
decodeDigit
private static final int decodeDigit(int cp)
- Returns:
- the numeric value of a basic code point (for use in representing integers) in the range 0 to BASE-1, or a negative value if cp is invalid.
-
asciiCaseMap
private static char asciiCaseMap(char b, boolean uppercase)
-
digitToBasic
private static char digitToBasic(int digit, boolean uppercase)
digitToBasic() returns the basic code point whose value (when used for representing integers) is d, which must be in the range 0 to BASE-1. The lowercase form is used unless the uppercase flag is nonzero, in which case the uppercase form is used.
-
encode
public static java.lang.StringBuilder encode(java.lang.CharSequence src, boolean[] caseFlags) throws StringPrepParseException
Converts Unicode to Punycode. The input string must not contain single, unpaired surrogates. The output will be represented as an array of ASCII code points.- Parameters:
src
- The source of the String Buffer passed.caseFlags
- The boolean array of case flags.- Returns:
- An array of ASCII code points.
- Throws:
StringPrepParseException
-
isBasic
private static boolean isBasic(int ch)
-
isBasicUpperCase
private static boolean isBasicUpperCase(int ch)
-
isSurrogate
private static boolean isSurrogate(int ch)
-
decode
public static java.lang.StringBuilder decode(java.lang.CharSequence src, boolean[] caseFlags) throws StringPrepParseException
Converts Punycode to Unicode. The Unicode string will be at most as long as the Punycode string.- Parameters:
src
- The source of the string buffer being passed.caseFlags
- The array of boolean case flags.- Returns:
- StringBuilder string.
- Throws:
StringPrepParseException
-
-