Class CodecSpec

java.lang.Object
org.cryptacular.spec.CodecSpec
All Implemented Interfaces:
Spec<Codec>

public class CodecSpec extends Object implements Spec<Codec>
Describes a string-to-byte encoding provides a means to create a new instance of the coed via the newInstance() method.
Author:
Middleware Services
  • Field Details

    • HEX

      public static final CodecSpec HEX
      Hexadecimal encoding specification.
    • HEX_LOWER

      public static final CodecSpec HEX_LOWER
      Lowercase hexadecimal encoding specification.
    • HEX_UPPER

      public static final CodecSpec HEX_UPPER
      Uppercase hexadecimal encoding specification.
    • BASE32

      public static final CodecSpec BASE32
      Base32 encoding specification.
    • BASE32_UNPADDED

      public static final CodecSpec BASE32_UNPADDED
      Unpadded base32 encoding specification.
    • BASE64

      public static final CodecSpec BASE64
      Base64 encoding specification.
    • BASE64_URLSAFE

      public static final CodecSpec BASE64_URLSAFE
      URL-safe base64 encoding specification.
    • BASE64_UNPADDED

      public static final CodecSpec BASE64_UNPADDED
      Unpadded base64 encoding specification.
  • Constructor Details

    • CodecSpec

      public CodecSpec(String encoding)
      Creates a new instance of the given encoding.
      Parameters:
      encoding - Name of encoding.
  • Method Details

    • getAlgorithm

      public String getAlgorithm()
      Specified by:
      getAlgorithm in interface Spec<Codec>
      Returns:
      The name of the encoding, e.g. "Hex", "Base32", "Base64".
    • newInstance

      public Codec newInstance()
      Description copied from interface: Spec
      Creates a new instance of the cryptographic primitive described by this specification.
      Specified by:
      newInstance in interface Spec<Codec>
      Returns:
      New instance of cryptographic primitive.
    • toString

      public String toString()
      Overrides:
      toString in class Object