Package java.net
Class IDN
java.lang.Object
java.net.IDN
public final class IDN extends Object
Converts internationalized domain names between Unicode and the ASCII Compatible Encoding
(ACE) representation.
See RFC 3490 for full details.
- Since:
- 1.6
-
Field Summary
Fields Modifier and Type Field Description static intALLOW_UNASSIGNEDWhen set, allows IDN to process unassigned unicode points.static intUSE_STD3_ASCII_RULES -
Method Summary
Modifier and Type Method Description static StringtoASCII(String input)Equivalent totoASCII(input, 0).static StringtoASCII(String input, int flags)Transform a Unicode String to ASCII Compatible Encoding String according to the algorithm defined in RFC 3490.static StringtoUnicode(String input)Equivalent totoUnicode(input, 0).static StringtoUnicode(String input, int flags)Translates a string from ASCII Compatible Encoding (ACE) to Unicode according to the algorithm defined in RFC 3490.
-
Field Details
-
ALLOW_UNASSIGNED
public static final int ALLOW_UNASSIGNEDWhen set, allows IDN to process unassigned unicode points.- See Also:
- Constant Field Values
-
USE_STD3_ASCII_RULES
public static final int USE_STD3_ASCII_RULES- See Also:
- Constant Field Values
-
-
Method Details
-
toASCII
Transform a Unicode String to ASCII Compatible Encoding String according to the algorithm defined in RFC 3490.If the transformation fails (because the input is not a valid IDN), an exception will be thrown.
This method can handle either an individual label or an entire domain name. In the latter case, the separators are: U+002E (full stop), U+3002 (ideographic full stop), U+FF0E (fullwidth full stop), and U+FF61 (halfwidth ideographic full stop). All of these will become U+002E (full stop) in the result.
- Parameters:
input- the Unicode nameflags- 0,ALLOW_UNASSIGNED,USE_STD3_ASCII_RULES, orALLOW_UNASSIGNED | USE_STD3_ASCII_RULES- Returns:
- the ACE name
- Throws:
IllegalArgumentException- ifinputdoes not conform to RFC 3490
-
toASCII
Equivalent totoASCII(input, 0).- Parameters:
input- the Unicode name- Returns:
- the ACE name
- Throws:
IllegalArgumentException- ifinputdoes not conform to RFC 3490
-
toUnicode
Translates a string from ASCII Compatible Encoding (ACE) to Unicode according to the algorithm defined in RFC 3490.Unlike
toASCII, this transformation cannot fail.This method can handle either an individual label or an entire domain name. In the latter case, the separators are: U+002E (full stop), U+3002 (ideographic full stop), U+FF0E (fullwidth full stop), and U+FF61 (halfwidth ideographic full stop).
- Parameters:
input- the ACE nameflags- 0,ALLOW_UNASSIGNED,USE_STD3_ASCII_RULES, orALLOW_UNASSIGNED | USE_STD3_ASCII_RULES- Returns:
- the Unicode name
-
toUnicode
Equivalent totoUnicode(input, 0).- Parameters:
input- the ACE name- Returns:
- the Unicode name
-