Decoder (Apache Tomcat 8.5.78 API Documentation)

Package org.apache.tomcat.util.codec

## Interface Decoder

- All Known Subinterfaces:
    `BinaryDecoder`
  All Known Implementing Classes:
    `Base64`, `BaseNCodec`

      @Deprecated
      public interface Decoder

  Deprecated.
  This interface is unused and will be removed in Tomcat 9
  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

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Object` | `decode​(Object source)` | Deprecated. Decodes an "encoded" Object and returns a "decoded" Object.

- - ### Method Detail

    - #### decode

          Object decode​(Object source)
                 throws DecoderException

      Deprecated.
      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` - a decoder exception can be thrown for any number of reasons. Some good candidates are that the parameter passed to this method is null, a param cannot be cast to the appropriate type for a specific encoder.