Interface Decoder

All Known Subinterfaces:
BinaryDecoder, StringDecoder
All Known Implementing Classes:
Base16, Base32, Base45, Base58, Base64, BaseNCodec, BCodec, BinaryCodec, Hex, PercentCodec, QCodec, QuotedPrintableCodec, URLCodec

public interface Decoder
Provides the highest level of abstraction for Decoders.

This is the sister interface of Encoder. All Decoders implement this common generic interface. Allows a user to pass a generic Object to any Decoder implementation in the codec package.

One of the two interfaces at the center of the codec package.

  • Method Summary

    Modifier and Type
    Method
    Description
    decode(Object source)
    Decodes an "encoded" Object and returns a "decoded" Object.
  • Method Details

    • decode

      Decodes an "encoded" Object and returns a "decoded" Object. Note that the implementation of this interface will try to cast the Object parameter to the specific type expected by a particular Decoder implementation. If a ClassCastException occurs, this decode method will throw a DecoderException.
      Parameters:
      source - the object to decode.
      Returns:
      A "decoded" object.
      Throws:
      DecoderException - Thrown if decoding fails, for example, because the parameter is null or cannot be cast to the appropriate type for a specific decoder.