org.restlet.data

## Class CharacterSet

- java.lang.Object
- - org.restlet.data.Metadata
  - - org.restlet.data.CharacterSet

    public final class CharacterSet
    extends Metadata

Character set used to encode characters in textual representations.

Author:
  Jerome Louvel

### Field Summary

Fields
`static CharacterSet` `ALL` All character sets acceptable.
`static CharacterSet` `DEFAULT` The default character set of the JVM.
`static CharacterSet` `ISO_8859_1` The ISO/IEC 8859-1 (Latin 1) character set.
`static CharacterSet` `ISO_8859_10` The ISO/IEC 8859-10 (Latin 6) character set.
`static CharacterSet` `ISO_8859_2` The ISO/IEC 8859-2 (Latin 2) character set.
`static CharacterSet` `ISO_8859_3` The ISO/IEC 8859-3 (Latin 3) character set.
`static CharacterSet` `ISO_8859_4` The ISO/IEC 8859-4 (Latin 4) character set.
`static CharacterSet` `ISO_8859_5` The ISO/IEC 8859-5 (Cyrillic) character set.
`static CharacterSet` `ISO_8859_6` The ISO/IEC 8859-6 (Arabic) character set.
`static CharacterSet` `ISO_8859_7` The ISO/IEC 8859-7 (Greek) character set.
`static CharacterSet` `ISO_8859_8` The ISO/IEC 8859-8 (Hebrew) character set.
`static CharacterSet` `ISO_8859_9` The ISO/IEC 8859-9 (Latin 5) character set.
`static CharacterSet` `MACINTOSH` The Macintosh ("Mac OS Roman") character set.
`static CharacterSet` `US_ASCII` The US-ASCII character set.
`static CharacterSet` `UTF_16` The UTF-16 character set.
`static CharacterSet` `UTF_8` The UTF-8 character set.
`static CharacterSet` `WINDOWS_1252` The Windows-1252 ('ANSI') character set.

### Constructor Summary

Constructors
Constructor and Description
`CharacterSet(java.nio.charset.Charset charset)` Constructor.
`CharacterSet(java.lang.String name)` Constructor.
`CharacterSet(java.lang.String name, java.lang.String description)` Constructor.

### Method Summary

Methods
`boolean` `equals(java.lang.Object object)`
`Metadata` `getParent()` Returns the parent metadata if available or null.
`int` `hashCode()`
`boolean` `includes(Metadata included)` Indicates if a given character set is included in the current one.
`java.nio.charset.Charset` `toCharset()` Returns the NIO charset matching the character set name.
`static CharacterSet` `valueOf(java.lang.String name)` Returns the character set associated to a name.

### Methods inherited from class org.restlet.data.Metadata

`getDescription, getName, isCompatible, toString`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Field Detail

#### ALL

    public static final CharacterSet ALL

All character sets acceptable.

#### ISO_8859_1

    public static final CharacterSet ISO_8859_1

The ISO/IEC 8859-1 (Latin 1) character set.

See Also:
  Wikipedia page

#### ISO_8859_2

    public static final CharacterSet ISO_8859_2

The ISO/IEC 8859-2 (Latin 2) character set.

See Also:
  Wikipedia page

#### ISO_8859_3

    public static final CharacterSet ISO_8859_3

The ISO/IEC 8859-3 (Latin 3) character set.

See Also:
  Wikipedia page

#### ISO_8859_4

    public static final CharacterSet ISO_8859_4

The ISO/IEC 8859-4 (Latin 4) character set.

See Also:
  Wikipedia page

#### ISO_8859_5

    public static final CharacterSet ISO_8859_5

The ISO/IEC 8859-5 (Cyrillic) character set.

See Also:
  Wikipedia page

#### ISO_8859_6

    public static final CharacterSet ISO_8859_6

The ISO/IEC 8859-6 (Arabic) character set.

See Also:
  Wikipedia page

#### ISO_8859_7

    public static final CharacterSet ISO_8859_7

The ISO/IEC 8859-7 (Greek) character set.

See Also:
  Wikipedia page

#### ISO_8859_8

    public static final CharacterSet ISO_8859_8

The ISO/IEC 8859-8 (Hebrew) character set.

See Also:
  Wikipedia page

#### ISO_8859_9

    public static final CharacterSet ISO_8859_9

The ISO/IEC 8859-9 (Latin 5) character set.

See Also:
  Wikipedia page

#### ISO_8859_10

    public static final CharacterSet ISO_8859_10

The ISO/IEC 8859-10 (Latin 6) character set.

See Also:
  Wikipedia page

#### MACINTOSH

    public static final CharacterSet MACINTOSH

The Macintosh ("Mac OS Roman") character set.

See Also:
  Wikipedia page

#### US_ASCII

    public static final CharacterSet US_ASCII

The US-ASCII character set.

See Also:
  Wikipedia page

#### UTF_16

    public static final CharacterSet UTF_16

The UTF-16 character set.

See Also:
  Wikipedia page

#### UTF_8

    public static final CharacterSet UTF_8

The UTF-8 character set.

See Also:
  Wikipedia page

#### WINDOWS_1252

    public static final CharacterSet WINDOWS_1252

The Windows-1252 ('ANSI') character set.

See Also:
  Wikipedia page

#### DEFAULT

    public static final CharacterSet DEFAULT

The default character set of the JVM.

See Also:
  `Charset.defaultCharset()`

### Constructor Detail

#### CharacterSet

    public CharacterSet(java.nio.charset.Charset charset)

Constructor.

Parameters:
  `charset` - The character set.

#### CharacterSet

    public CharacterSet(java.lang.String name)

Constructor.

Parameters:
  `name` - The name.

#### CharacterSet

    public CharacterSet(java.lang.String name,
                java.lang.String description)

Constructor.

Parameters:
  `name` - The name.
  `description` - The description.

### Method Detail

#### valueOf

    public static CharacterSet valueOf(java.lang.String name)

Returns the character set associated to a name. If an existing constant exists then it is returned, otherwise a new instance is created.

Parameters:
  `name` - The name.
Returns:
  The associated character set.

#### equals

    public boolean equals(java.lang.Object object)

Overrides:
  `equals` in class `Metadata`

#### getParent

    public Metadata getParent()

Description copied from class: `Metadata`
Returns the parent metadata if available or null.

Specified by:
  `getParent` in class `Metadata`
Returns:
  The parent metadata.

#### hashCode

    public int hashCode()

Overrides:
  `hashCode` in class `Metadata`

#### includes

    public boolean includes(Metadata included)

Indicates if a given character set is included in the current one. The test is true if both character sets are equal or if the given character set is within the range of the current one. For example, ALL includes all character sets. A null character set is considered as included into the current one.

Examples:

- ALL.includes(UTF_16) -> true
- UTF_16.includes(ALL) -> false

Specified by:
  `includes` in class `Metadata`
Parameters:
  `included` - The character set to test for inclusion.
Returns:
  True if the given character set is included in the current one.
See Also:
  `Metadata.isCompatible(Metadata)`

#### toCharset

    public java.nio.charset.Charset toCharset()

Returns the NIO charset matching the character set name.

Returns:
  The NIO charset.