Class CharacterSet


  • public final class CharacterSet
    extends Metadata
    Metadata used to specify the character set of textual representations.
    Author:
    Jerome Louvel
    • 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.
      • 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:
        Metadata.isCompatible(Metadata)
      • toCharset

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