# Class Base16

java.lang.Object
org.apache.commons.codec.binary.BaseNCodec
org.apache.commons.codec.binary.Base16

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

public class Base16 extends BaseNCodec
Provides Base16 encoding and decoding as defined by RFC 4648 - 8. Base 16 Encoding.

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:
  - `Base16InputStream`
  - `Base16OutputStream`
  - RFC 4648 - 8. Base 16 Encoding

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `Base16.Builder`
  Builds `Base16` instances.

  ### Nested classes/interfaces inherited from class BaseNCodec

  `BaseNCodec.AbstractBuilder<T,B>`

- ## Field Summary

  ### Fields inherited from class BaseNCodec

  `DECODING_POLICY_DEFAULT, lineLength, MASK_8BITS, MIME_CHUNK_SIZE, pad, PAD, PAD_DEFAULT, PEM_CHUNK_SIZE`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Base16()`
  Constructs a Base16 codec used for decoding and encoding.
  `Base16(boolean lowerCase)`
  Deprecated.
  Use `builder()` and `Base16.Builder`.
  `Base16(boolean lowerCase, CodecPolicy decodingPolicy)`
  Deprecated.
  Use `builder()` and `Base16.Builder`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Base16.Builder`
  `builder()`
  Constructs a new builder.
  `boolean`
  `isInAlphabet(byte octet)`
  Returns whether or not the `octet` is in the Base16 alphabet.

  ### Methods inherited from class BaseNCodec

  `containsAlphabetOrPad, decode, decode, decode, encode, encode, encode, encodeAsString, encodeToString, ensureBufferSize, getChunkSeparator, getCodecPolicy, getDefaultBufferSize, getEncodedLength, isInAlphabet, isInAlphabet, isStrictDecoding, isWhiteSpace`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Base16

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

  - ### Base16

    @Deprecated public Base16(boolean lowerCase)
    Deprecated.
    Use `builder()` and `Base16.Builder`.
    Constructs a Base16 codec used for decoding and encoding.
    Parameters:
      `lowerCase` - `true` to use the lower-case Base16 alphabet.

  - ### Base16

    @Deprecated public Base16(boolean lowerCase, CodecPolicy decodingPolicy)
    Deprecated.
    Use `builder()` and `Base16.Builder`.
    Constructs a Base16 codec used for decoding and encoding.
    Parameters:
      `lowerCase` - `true` to use the lower-case Base16 alphabet.
      `decodingPolicy` - Decoding policy.

- ## Method Details

  - ### builder

    public static Base16.Builder builder()
    Constructs a new builder.
    Returns:
      a new builder.
    Since:
      1.20.0

  - ### 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 Base16 alphabet `false` otherwise.