Decoder.java revision d42abb2fd917184764daf22f5f299e848b8701d7
1/*
2 * Copyright 2001-2004 The Apache Software Foundation.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.apache.commons.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 * @deprecated Please use {@link java.net.URL#openConnection} instead.
33 *     Please visit <a href="http://android-developers.blogspot.com/2011/09/androids-http-clients.html">this webpage</a>
34 *     for further details.
35 */
36@Deprecated
37public interface Decoder {
38
39    /**
40     * Decodes an "encoded" Object and returns a "decoded"
41     * Object.  Note that the implementation of this
42     * interface will try to cast the Object parameter
43     * to the specific type expected by a particular Decoder
44     * implementation.  If a {@link java.lang.ClassCastException} occurs
45     * this decode method will throw a DecoderException.
46     *
47     * @param pObject an object to "decode"
48     *
49     * @return a 'decoded" object
50     *
51     * @throws DecoderException a decoder exception can
52     * be thrown for any number of reasons.  Some good
53     * candidates are that the parameter passed to this
54     * method is null, a param cannot be cast to the
55     * appropriate type for a specific encoder.
56     */
57    Object decode(Object pObject) throws DecoderException;
58}
59
60