Class Alphabet

  • Direct Known Subclasses:
    Base32Alphabet, Base64Alphabet

    public abstract class Alphabet
    extends Object
    A base-n encoder/decoder alphabet. Alphabets may be little-endian or big-endian. Each base has its own subclass.
    • Method Detail

      • isLittleEndian

        public boolean isLittleEndian()
        Determine whether this is a little-endian or big-endian alphabet.
        Returns:
        true if the alphabet is little-endian, false if it is big-endian
      • encode

        public abstract int encode​(int val)
        Encode the given byte value to a code point.
        Parameters:
        val - the value
        Returns:
        the Unicode code point
      • decode

        public abstract int decode​(int codePoint)
        Decode the given code point (character). If the code point is not valid, -1 is returned.
        Parameters:
        codePoint - the Unicode code point
        Returns:
        the decoded value or -1 if the code point is not valid