1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.asn1.codec;
18
19 /***
20 * <p>Provides the highest level of abstraction for Decoders.
21 * This is the sister interface of {@link Encoder}. All
22 * Decoders implement this common generic interface.</p>
23 *
24 * <p>Allows a user to pass a generic Object to any Decoder
25 * implementation in the codec package.</p>
26 *
27 * <p>One of the two interfaces at the center of the codec package.</p>
28 *
29 * @author Apache Software Foundation
30 * @version $Id: Decoder.java,v 1.9 2004/02/29 04:08:31 tobrien Exp $
31 */
32 public interface Decoder {
33
34 /***
35 * Decodes an "encoded" Object and returns a "decoded"
36 * Object. Note that the implementation of this
37 * interface will try to cast the Object parameter
38 * to the specific type expected by a particular Decoder
39 * implementation. If a {@link java.lang.ClassCastException} occurs
40 * this decode method will throw a DecoderException.
41 *
42 * @param pObject an object to "decode"
43 *
44 * @return a 'decoded" object
45 *
46 * @throws DecoderException a decoder exception can
47 * be thrown for any number of reasons. Some good
48 * candidates are that the parameter passed to this
49 * method is null, a param cannot be cast to the
50 * appropriate type for a specific encoder.
51 */
52 Object decode(Object pObject) throws DecoderException;
53 }
54