001    // Copyright 2007 Waterken Inc. under the terms of the MIT X license
002    // found at http://www.opensource.org/licenses/mit-license.html
003    package org.waterken.syntax;
004    
005    import java.io.InputStream;
006    import java.lang.reflect.Type;
007    
008    import org.joe_e.Powerless;
009    import org.joe_e.array.ConstArray;
010    
011    /**
012     * An object deserializer.
013     */
014    public interface
015    Deserializer extends Powerless {
016    
017        /**
018         * Deserializes an object.
019         * @param content   serialized content, will be closed
020         * @param connect   reference importer
021         * @param base      base URL
022         * @param code      class loader
023         * @param type      expected type of the referenced object
024         * @return deserialized object
025         * @throws Exception    any exception
026         */
027        Object deserialize(InputStream content, Importer connect, String base,
028                           ClassLoader code, Type type) throws Exception;
029    
030        /**
031         * Deserializes an argument list.
032         * @param content       serialized content, will be closed
033         * @param connect       reference importer
034         * @param base          base URL
035         * @param code          class loader
036         * @param parameters    expected type of each argument
037         * @return deserialized tuple
038         * @throws Exception    any exception
039         */
040        ConstArray<?> deserializeTuple(InputStream content, Importer connect,
041                                       String base, ClassLoader code,
042                                       Type... parameters) throws Exception;
043    }