Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (C) FuseSource, Inc. http://fusesource.com Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
package org.fusesource.fabric.dosgi.util;
public class ClassLoaderObjectInputStream extends ObjectInputStream {

    

Maps primitive type names to corresponding class objects.

    private static final HashMap<StringClassprimClasses = new HashMap<StringClass>(8, 1.0F);
    private ClassLoader classLoader;
    public ClassLoaderObjectInputStream(InputStream inthrows IOException {
        super(in);
    }
    public ClassLoader getClassLoader() {
        return ;
    }
    public void setClassLoader(ClassLoader classLoader) {
        this. = classLoader;
    }
    protected Class resolveClass(ObjectStreamClass classDescthrows IOExceptionClassNotFoundException {
        return load(classDesc.getName());
    }
    protected Class resolveProxyClass(String[] interfacesthrows IOExceptionClassNotFoundException {
        Class[] cinterfaces = new Class[interfaces.length];
        for (int i = 0; i < interfaces.lengthi++) {
            cinterfaces[i] = load(interfaces[i]);
        }
        try {
            return Proxy.getProxyClass(cinterfaces);
        } catch (IllegalArgumentException e) {
            throw new ClassNotFoundException(nulle);
        }
    }
    private Class load(String className)
            throws ClassNotFoundException {
        try {
            return Class.forName(classNamefalse);
        } catch (ClassNotFoundException e) {
            final Class clazz = .get(className);
            if (clazz != null) {
                return clazz;
            } else {
                throw e;
            }
        }
    }
    static {
        .put("boolean"boolean.class);
        .put("byte"byte.class);
        .put("char"char.class);
        .put("short"short.class);
        .put("int"int.class);
        .put("long"long.class);
        .put("float"float.class);
        .put("double"double.class);
        .put("void"void.class);
    }
New to GrepCode? Check out our FAQ X