All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.cudoy.framework.cache.redis.ObjectStream Maven / Gradle / Ivy

The newest version!
package com.cudoy.framework.cache.redis;

import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectStreamClass;

public class ObjectStream extends ObjectInputStream{

    protected ClassLoader classLoader = this.getClass().getClassLoader();

    public ObjectStream(InputStream in) throws IOException {
        super(in);
    }
    public ObjectStream(InputStream in, ClassLoader classLoader) throws IOException {
        super(in);
        this.classLoader = classLoader;
    }

    @Override
    protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
        String name = desc.getName();
        try {
            return Class.forName(name, false, this.classLoader);
        }catch (Exception e){
            return super.resolveClass(desc);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy