KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > codec > Decoder


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
17 package 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 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 JavaDoc decode(Object JavaDoc pObject) throws DecoderException;
53 }
54
55
Popular Tags