Class AbstractEncodingConverter

java.lang.Object
edu.vt.middleware.crypt.util.AbstractEncodingConverter
All Implemented Interfaces:
Converter
Direct Known Subclasses:
Base64Converter, HexConverter

public abstract class AbstractEncodingConverter extends Object implements Converter
Abstract base class for all converters that perform encoding with a BC Encoder class.
Version:
$Revision: 2744 $
Author:
Middleware Services
  • Constructor Details

    • AbstractEncodingConverter

      public AbstractEncodingConverter()
  • Method Details

    • fromBytes

      public String fromBytes(byte[] input)
      Converts a byte array to a formatted/encoded string.
      Specified by:
      fromBytes in interface Converter
      Parameters:
      input - Input bytes.
      Returns:
      Formatted/encoded string derived from input bytes.
    • fromBytes

      public String fromBytes(byte[] input, int offset, int length)
      Converts a byte array to a formatted/encoded string.
      Specified by:
      fromBytes in interface Converter
      Parameters:
      input - Input bytes.
      offset - Offset into input bytes at which to begin processing.
      length - Number of bytes of input data to process.
      Returns:
      Formatted/encoded string derived from input bytes.
    • toBytes

      public byte[] toBytes(String input)
      Converts a formatted/encoded string to raw bytes.
      Specified by:
      toBytes in interface Converter
      Parameters:
      input - Formatted/encoded input string.
      Returns:
      Byte array corresponding to input string.
    • getEncoder

      protected abstract org.bouncycastle.util.encoders.Encoder getEncoder()
      Gets the encoder instance that does the work of byte-char/char-byte encoding.
      Returns:
      Encoder instance.