Class Base64Codec

java.lang.Object
org.cryptacular.codec.Base64Codec
All Implemented Interfaces:
Codec

public class Base64Codec extends Object implements Codec
Base 64 encoder/decoder pair.
Author:
Middleware Services
  • Constructor Details

    • Base64Codec

      public Base64Codec()
      Creates a new instance using the base-64 alphabet defined in RFC 4648.
    • Base64Codec

      public Base64Codec(String alphabet)
      Creates a new instance using the given 64-character alphabet.
      Parameters:
      alphabet - 64-character alphabet to use.
    • Base64Codec

      public Base64Codec(String alphabet, boolean inputOutputPadding)
      Creates a new instance using the given 64-character alphabet with option to enable/disable padding.
      Parameters:
      alphabet - 64-character alphabet to use.
      inputOutputPadding - True to enable support for padding, false otherwise.
  • Method Details

    • getEncoder

      public Encoder getEncoder()
      Specified by:
      getEncoder in interface Codec
      Returns:
      The byte-to-char encoder of the codec pair.
    • getDecoder

      public Decoder getDecoder()
      Specified by:
      getDecoder in interface Codec
      Returns:
      The char-to-byte decoder of the codec pair.
    • newEncoder

      public Encoder newEncoder()
      Specified by:
      newEncoder in interface Codec
      Returns:
      A new instance of the byte-to-char encoder of the codec pair.
    • newDecoder

      public Decoder newDecoder()
      Specified by:
      newDecoder in interface Codec
      Returns:
      A new instance of the char-to-byte decoder of the codec pair.