Class CharacterSet

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

public final class CharacterSet extends Metadata
Metadata used to specify the character set of textual representations.
Author:
Jerome Louvel
  • Field Details

  • Constructor Details

    • CharacterSet

      public CharacterSet(Charset charset)
      Constructor.
      Parameters:
      charset - The character set.
    • CharacterSet

      public CharacterSet(String name)
      Constructor.
      Parameters:
      name - The name.
    • CharacterSet

      public CharacterSet(String name, String description)
      Constructor.
      Parameters:
      name - The name.
      description - The description.
  • Method Details

    • valueOf

      public static CharacterSet valueOf(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(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) returns true
      • UTF_16.includes(ALL) returns 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:
    • toCharset

      public Charset toCharset()
      Returns the NIO charset matching the character set name.
      Returns:
      The NIO charset.