Class Base16

  • All Implemented Interfaces:
    BinaryDecoder, BinaryEncoder, Decoder, Encoder

    public class Base16
    extends BaseNCodec
    Provides Base16 encoding and decoding.

    This class is thread-safe.

    This implementation strictly follows RFC 4648, and as such unlike the Base32 and Base64 implementations, it does not ignore invalid alphabet characters or whitespace, neither does it offer chunking or padding characters.

    The only additional feature above those specified in RFC 4648 is support for working with a lower-case alphabet in addition to the default upper-case alphabet.

    Since:
    1.15
    See Also:
    RFC 4648 - 8. Base 16 Encoding
    • Constructor Detail

      • Base16

        public Base16()
        Creates a Base16 codec used for decoding and encoding.
      • Base16

        public Base16​(boolean lowerCase)
        Creates a Base16 codec used for decoding and encoding.
        Parameters:
        lowerCase - if true then use a lower-case Base16 alphabet.
      • Base16

        public Base16​(boolean lowerCase,
                      CodecPolicy decodingPolicy)
        Creates a Base16 codec used for decoding and encoding.
        Parameters:
        lowerCase - if true then use a lower-case Base16 alphabet.
        decodingPolicy - Decoding policy.
    • Method Detail

      • isInAlphabet

        public boolean isInAlphabet​(byte octet)
        Returns whether or not the octet is in the Base16 alphabet.
        Specified by:
        isInAlphabet in class BaseNCodec
        Parameters:
        octet - The value to test.
        Returns:
        true if the value is defined in the the Base16 alphabet false otherwise.