# IDN

public final class **IDN** extends [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)  
Converts internationalized domain names between Unicode and the ASCII Compatible Encoding
(ACE) representation.

See [RFC 3490](http://www.ietf.org/rfc/rfc3490.txt) for full details.

### Constant Summary

|---|---|---|
| int | [ALLOW_UNASSIGNED](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/IDN.html#ALLOW_UNASSIGNED) | When set, allows IDN to process unassigned unicode points. |
| int | [USE_STD3_ASCII_RULES](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/IDN.html#USE_STD3_ASCII_RULES) | When set, ASCII strings are checked against [RFC 1122](http://www.ietf.org/rfc/rfc1122.txt) and [RFC 1123](http://www.ietf.org/rfc/rfc1123.txt). |

### Public Method Summary

|---|---|
| static [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toASCII](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/IDN.html#toASCII(java.lang.String,%20int))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) input, int flags) Transform a Unicode String to ASCII Compatible Encoding String according to the algorithm defined in [RFC 3490](http://www.ietf.org/rfc/rfc3490.txt). |
| static [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toASCII](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/IDN.html#toASCII(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) input) Equivalent to `toASCII(input, 0)`. |
| static [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toUnicode](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/IDN.html#toUnicode(java.lang.String,%20int))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) input, int flags) Translates a string from ASCII Compatible Encoding (ACE) to Unicode according to the algorithm defined in [RFC 3490](http://www.ietf.org/rfc/rfc3490.txt). |
| static [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toUnicode](https://developers.google.com/j2objc/javadoc/jre/reference/java/net/IDN.html#toUnicode(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) input) Equivalent to `toUnicode(input, 0)`. |

### Inherited Method Summary

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

## Constants

#### public static final int
**ALLOW_UNASSIGNED**

When set, allows IDN to process unassigned unicode points.
Constant Value: 1

#### public static final int
**USE_STD3_ASCII_RULES**

When set, ASCII strings are checked against
[RFC 1122](http://www.ietf.org/rfc/rfc1122.txt) and
[RFC 1123](http://www.ietf.org/rfc/rfc1123.txt).
Constant Value: 2

## Public Methods

#### public static [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**toASCII**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) input, int flags)

Transform a Unicode String to ASCII Compatible Encoding String according
to the algorithm defined in [RFC 3490](http://www.ietf.org/rfc/rfc3490.txt).

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 name |
| flags | 0, `ALLOW_UNASSIGNED`, `USE_STD3_ASCII_RULES`, or `ALLOW_UNASSIGNED | USE_STD3_ASCII_RULES` |
|---|---|

##### Returns

- the ACE name

##### Throws

| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if `input` does not conform to [RFC 3490](http://www.ietf.org/rfc/rfc3490.txt) |
|---|---|

#### public static [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**toASCII**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) input)

Equivalent to `toASCII(input, 0)`.

##### Parameters

| input | the Unicode name |
|---|---|

##### Returns

- the ACE name

##### Throws

| [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html) | if `input` does not conform to [RFC 3490](http://www.ietf.org/rfc/rfc3490.txt) |
|---|---|

#### public static [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**toUnicode**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) input, int flags)

Translates a string from ASCII Compatible Encoding (ACE) to Unicode
according to the algorithm defined in [RFC 3490](http://www.ietf.org/rfc/rfc3490.txt).

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 name |
| flags | 0, `ALLOW_UNASSIGNED`, `USE_STD3_ASCII_RULES`, or `ALLOW_UNASSIGNED | USE_STD3_ASCII_RULES` |
|---|---|

##### Returns

- the Unicode name

#### public static [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html)
**toUnicode**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) input)

Equivalent to `toUnicode(input, 0)`.

##### Parameters

| input | the ACE name |
|---|---|

##### Returns

- the Unicode name