Class ASCIICharProp

  • All Implemented Interfaces:
    Comparable<ASCIICharProp>

    public final class ASCIICharProp
    extends Object
    implements Comparable<ASCIICharProp>
    A ASCIICharProp provides fast access to ASCII character properties. In particular, the ability to query whether a character is a letter, a digit, hexadecimal character, as well as various methods for performing character conversions.

    The methods in this class do not perform memory allocations nor calculations and so can be used safely in high performance situations.

    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      char charValue()
      Returns the char value associated with this ASCIICharProp.
      int compareTo​(ASCIICharProp o)  
      int decimalValue()
      Returns the decimal value associated with this ASCIICharProp, or -1 if the value is not a decimal digit.
      boolean equals​(Object obj)  
      int hashCode()  
      int hexValue()
      Returns the hexadecimal value associated with this ASCIICharProp , or -1 if the value is not a hexadecimal digit.
      boolean isDigit()
      Indicates whether the char value associated with this ASCIICharProp is a decimal digit.
      boolean isHexDigit()
      Indicates whether the char value associated with this ASCIICharProp is a hexadecimal digit.
      boolean isKeyChar​(boolean allowCompatChars)
      Indicates whether the char value associated with this ASCIICharProp is a keychar as defined in RFC 4512.
      boolean isLetter()
      Indicates whether the char value associated with this ASCIICharProp is a letter.
      boolean isLowerCase()
      Indicates whether the char value associated with this ASCIICharProp is a lower-case character.
      boolean isUpperCase()
      Indicates whether the char value associated with this ASCIICharProp is an upper-case character.
      char toLowerCase()
      Returns the lower-case char value associated with this ASCIICharProp.
      String toString()  
      char toUpperCase()
      Returns the upper-case char value associated with this ASCIICharProp.
      static ASCIICharProp valueOf​(char c)
      Returns the character properties for the provided ASCII character.
      static ASCIICharProp valueOf​(int c)
      Returns the character properties for the provided ASCII character.
    • Method Detail

      • valueOf

        public static ASCIICharProp valueOf​(char c)
        Returns the character properties for the provided ASCII character. If a non-ASCII character is provided then this method returns null.
        Parameters:
        c - The ASCII character.
        Returns:
        The character properties for the provided ASCII character, or null if c is greater than  .
      • valueOf

        public static ASCIICharProp valueOf​(int c)
        Returns the character properties for the provided ASCII character. If a non-ASCII character is provided then this method returns null.
        Parameters:
        c - The ASCII character.
        Returns:
        The character properties for the provided ASCII character, or null if c is less than zero or greater than  .
      • charValue

        public char charValue()
        Returns the char value associated with this ASCIICharProp.
        Returns:
        The char value associated with this ASCIICharProp.
      • decimalValue

        public int decimalValue()
        Returns the decimal value associated with this ASCIICharProp, or -1 if the value is not a decimal digit.
        Returns:
        The decimal value associated with this ASCIICharProp, or -1 if the value is not a decimal digit.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • hexValue

        public int hexValue()
        Returns the hexadecimal value associated with this ASCIICharProp , or -1 if the value is not a hexadecimal digit.
        Returns:
        The hexadecimal value associated with this ASCIICharProp , or -1 if the value is not a hexadecimal digit.
      • isDigit

        public boolean isDigit()
        Indicates whether the char value associated with this ASCIICharProp is a decimal digit.
        Returns:
        true if the char value associated with this ASCIICharProp is a decimal digit.
      • isHexDigit

        public boolean isHexDigit()
        Indicates whether the char value associated with this ASCIICharProp is a hexadecimal digit.
        Returns:
        true if the char value associated with this ASCIICharProp is a hexadecimal digit.
      • isKeyChar

        public boolean isKeyChar​(boolean allowCompatChars)
        Indicates whether the char value associated with this ASCIICharProp is a keychar as defined in RFC 4512. A keychar is a letter, a digit, or a hyphen. When allowCompatChars is true the following illegal characters will be permitted:
         HYPHEN  = %x2D ; hyphen ("-")
         DOT     = %x2E ; period (".")
         EQUALS  = %x3D ; equals sign ("=")
         USCORE  = %x5F ; underscore ("_")
         
        Parameters:
        allowCompatChars - true if certain illegal characters should be allowed for compatibility reasons.
        Returns:
        true if the char value associated with this ASCIICharProp is a keychar.
      • isLetter

        public boolean isLetter()
        Indicates whether the char value associated with this ASCIICharProp is a letter.
        Returns:
        true if the char value associated with this ASCIICharProp is a letter.
      • isLowerCase

        public boolean isLowerCase()
        Indicates whether the char value associated with this ASCIICharProp is a lower-case character.
        Returns:
        true if the char value associated with this ASCIICharProp is a lower-case character.
      • isUpperCase

        public boolean isUpperCase()
        Indicates whether the char value associated with this ASCIICharProp is an upper-case character.
        Returns:
        true if the char value associated with this ASCIICharProp is an upper-case character.
      • toLowerCase

        public char toLowerCase()
        Returns the lower-case char value associated with this ASCIICharProp.
        Returns:
        The lower-case char value associated with this ASCIICharProp.
      • toUpperCase

        public char toUpperCase()
        Returns the upper-case char value associated with this ASCIICharProp.
        Returns:
        The upper-case char value associated with this ASCIICharProp.