CharSet (Apache Ant API)
Description: declaration: package: org.apache.tools.ant.types, class: CharSet

# Class CharSet

java.lang.Object
org.apache.tools.ant.types.EnumeratedAttribute
org.apache.tools.ant.types.CharSet

public class CharSet extends EnumeratedAttribute
EnumeratedAttribute implementation for Charset to use with encoding/charset attributes.

Since:
  Ant 1.10.6

- ## Field Summary

  ### Fields inherited from class EnumeratedAttribute

  `value`
  Modifier and Type
  Field
  Description
  `protected String`
  `value`
  The selected value in this enumeration.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `CharSet()`
  Default constructor.
  `CharSet(String value)`
  Construct a new CharSet with the specified value.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equivalent(CharSet cs)`
  Tell if CharSet values are aliases.
  `static CharSet`
  `getAscii()`
  Convenience methood: get US-ASCII CharSet.
  `Charset`
  `getCharset()`
  Convert this enumerated type to a `Charset`.
  `static CharSet`
  `getDefault()`
  Get the default value as provided by Charset.
  `static CharSet`
  `getUtf8()`
  Convenience method: get UTF-8 CharSet.
  `String[]`
  `getValues()`
  Return the possible values.
  `final void`
  `setValue(String value)`
  Accept additional values for backwards compatibility (some java.io encoding names not available in java.nio)

  ### Methods inherited from class EnumeratedAttribute

  `containsValue, getIndex, getInstance, getValue, indexOfValue, toString`
  Modifier and Type
  Method
  Description
  `final boolean`
  `containsValue(String value)`
  Is this value included in the enumeration?
  `final int`
  `getIndex()`
  `static EnumeratedAttribute`
  `getInstance(Class<? extends EnumeratedAttribute> clazz, String value)`
  Factory method for instantiating EAs via API in a more developer friendly way.
  `final String`
  `getValue()`
  `final int`
  `indexOfValue(String value)`
  get the index of a value in this enumeration.
  `String`
  `toString()`
  Convert the value to its string form.

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### CharSet

    public CharSet()
    Default constructor.

  - ### CharSet

    public CharSet(String value)
    Construct a new CharSet with the specified value.
    Parameters:
      `value` - the EnumeratedAttribute value.

- ## Method Details

  - ### getDefault

    public static CharSet getDefault()
    Get the default value as provided by Charset.
    Returns:
      the default value.

  - ### getAscii

    public static CharSet getAscii()
    Convenience methood: get US-ASCII CharSet.
    Returns:
      the default value.

  - ### getUtf8

    public static CharSet getUtf8()
    Convenience method: get UTF-8 CharSet.
    Returns:
      the default value.

  - ### equivalent

    public boolean equivalent(CharSet cs)
    Tell if CharSet values are aliases.
    Parameters:
      `cs` - CharSet to compare the value to.
    Returns:
      true if CharSet values are aliases.

  - ### getCharset

    public Charset getCharset()
    Convert this enumerated type to a `Charset`.
    Returns:
      a `Charset` object.

  - ### getValues

    public String[] getValues()
    Return the possible values.
    Specified by:
      `getValues` in class `EnumeratedAttribute`
    Returns:
      String[] of Charset names.

  - ### setValue

    public final void setValue(String value)
    Accept additional values for backwards compatibility (some java.io encoding names not available in java.nio)
    Overrides:
      `setValue` in class `EnumeratedAttribute`
    Parameters:
      `value` - the `String` value of the attribute