1069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project/* 2069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * Copyright 2001-2004 The Apache Software Foundation. 3069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * 4069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * Licensed under the Apache License, Version 2.0 (the "License"); 5069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * you may not use this file except in compliance with the License. 6069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * You may obtain a copy of the License at 7069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * 8069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * http://www.apache.org/licenses/LICENSE-2.0 9069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * 10069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * Unless required by applicable law or agreed to in writing, software 11069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * distributed under the License is distributed on an "AS IS" BASIS, 12069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * See the License for the specific language governing permissions and 14069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * limitations under the License. 15069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project */ 16069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 17069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Projectpackage org.apache.commons.codec; 18069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 19069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project/** 20069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * <p>Provides the highest level of abstraction for Decoders. 21069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * This is the sister interface of {@link Encoder}. All 22069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * Decoders implement this common generic interface.</p> 23069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * 24069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * <p>Allows a user to pass a generic Object to any Decoder 25069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * implementation in the codec package.</p> 26069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * 27069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * <p>One of the two interfaces at the center of the codec package.</p> 28069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * 29069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * @author Apache Software Foundation 30069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * @version $Id: Decoder.java,v 1.9 2004/02/29 04:08:31 tobrien Exp $ 31069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project */ 32069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Projectpublic interface Decoder { 33069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 34069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project /** 35069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * Decodes an "encoded" Object and returns a "decoded" 36069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * Object. Note that the implementation of this 37069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * interface will try to cast the Object parameter 38069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * to the specific type expected by a particular Decoder 39069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * implementation. If a {@link java.lang.ClassCastException} occurs 40069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * this decode method will throw a DecoderException. 41069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * 42069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * @param pObject an object to "decode" 43069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * 44069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * @return a 'decoded" object 45069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * 46069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * @throws DecoderException a decoder exception can 47069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * be thrown for any number of reasons. Some good 48069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * candidates are that the parameter passed to this 49069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * method is null, a param cannot be cast to the 50069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project * appropriate type for a specific encoder. 51069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project */ 52069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project Object decode(Object pObject) throws DecoderException; 53069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project} 54069490a5ca2fd1988d29daf45d892f47ad665115The Android Open Source Project 55