1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 * 19 */ 20 21 package org.apache.directory.api.asn1; 22 23 24 /** 25 * <p> 26 * Provides the highest level of abstraction for Decoders. This is the sister 27 * interface of {@link Encoder}. All Decoders implement this common generic 28 * interface. 29 * </p> 30 * <p> 31 * Allows a user to pass a generic Object to any Decoder implementation in the 32 * codec package. 33 * </p> 34 * <p> 35 * One of the two interfaces at the center of the codec package. 36 * </p> 37 * 38 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 39 */ 40 public interface Decoder 41 { 42 43 /** 44 * Decodes an "encoded" Object and returns a "decoded" Object. Note that the 45 * implementation of this interface will try to cast the Object parameter to 46 * the specific type expected by a particular Decoder implementation. If a 47 * {@link java.lang.ClassCastException} occurs this decode method will throw 48 * a DecoderException. 49 * 50 * @param object an object to "decode" 51 * @return a 'decoded" object 52 * @throws DecoderException a decoder exception can be thrown for any number of reasons. 53 * Some good candidates are that the parameter passed to this method is null, a param 54 * cannot be cast to the appropriate type for a specific encoder. 55 */ 56 Object decode( Object object ) throws DecoderException; 57 }