Top Description Fields Constructors Methods
com.ibm.icu.impl

public final Class Punycode

extends Object
Class Inheritance
Imports
com.ibm.icu.lang.UCharacter, com.ibm.icu.text.StringPrepParseException, .UTF16, com.ibm.icu.util.ICUInputTooLongException

Ported code from ICU punycode.c
Author
ram

Field Summary

Modifier and TypeField and Description
private static final int
private static final int
private static final int
private static final int
private static final int
private static final char
private static final int
private static final char
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static int
adaptBias(int delta, int length, boolean firstTime)

private static char
asciiCaseMap(char b, boolean uppercase)

public static StringBuilder

Returns:

StringBuilder string.
decode
(CharSequence
The source of the string buffer being passed.
src
,
boolean[]
The array of boolean case flags.
caseFlags
)

Converts Punycode to Unicode.

private static final int

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.
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.

public static StringBuilder

Returns:

An array of ASCII code points.
encode
(CharSequence
The source of the String Buffer passed.
src
,
boolean[]
The boolean array of case flags.
caseFlags
)

Converts Unicode to Punycode.

private static boolean
isBasic(int ch)

private static boolean
private static boolean
isSurrogate(int ch)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

BASEback to summary
private static final int BASE
CAPITAL_Aback to summary
private static final int CAPITAL_A
CAPITAL_Zback to summary
private static final int CAPITAL_Z
DAMPback to summary
private static final int DAMP
DECODE_MAX_CHARSback to summary
private static final int DECODE_MAX_CHARS
DELIMITERback to summary
private static final char DELIMITER
ENCODE_MAX_CODE_UNITSback to summary
private static final int ENCODE_MAX_CODE_UNITS
HYPHENback to summary
private static final char HYPHEN
INITIAL_BIASback to summary
private static final int INITIAL_BIAS
INITIAL_Nback to summary
private static final int INITIAL_N
SKEWback to summary
private static final int SKEW
SMALL_Aback to summary
private static final int SMALL_A
SMALL_Zback to summary
private static final int SMALL_Z
TMAXback to summary
private static final int TMAX
TMINback to summary
private static final int TMIN
ZEROback to summary
private static final int ZERO

Constructor Detail

Punycodeback to summary
public Punycode()

Method Detail

adaptBiasback to summary
private static int adaptBias(int delta, int length, boolean firstTime)
asciiCaseMapback to summary
private static char asciiCaseMap(char b, boolean uppercase)
decodeback to summary
public static StringBuilder decode(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:CharSequence

The source of the string buffer being passed.

caseFlags:boolean[]

The array of boolean case flags.

Returns:StringBuilder

StringBuilder string.

decodeDigitback to summary
private static final int decodeDigit(int cp)
Returns:int

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.

digitToBasicback to summary
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.

encodeback to summary
public static StringBuilder encode(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:CharSequence

The source of the String Buffer passed.

caseFlags:boolean[]

The boolean array of case flags.

Returns:StringBuilder

An array of ASCII code points.

isBasicback to summary
private static boolean isBasic(int ch)
isBasicUpperCaseback to summary
private static boolean isBasicUpperCase(int ch)
isSurrogateback to summary
private static boolean isSurrogate(int ch)