1 22 package org.jboss.util.stream; 23 24 import java.io.IOException ; 25 import java.io.InputStream ; 26 import java.io.ObjectInputStream ; 27 import java.io.ObjectStreamClass ; 28 29 37 public class MarshalledValueInputStream 38 extends ObjectInputStream 39 { 40 43 public MarshalledValueInputStream(InputStream is) throws IOException 44 { 45 super(is); 46 } 47 48 53 protected Class resolveClass(ObjectStreamClass v) 54 throws IOException , ClassNotFoundException 55 { 56 ClassLoader loader = Thread.currentThread().getContextClassLoader(); 57 String className = v.getName(); 58 return loader.loadClass(className); 59 } 60 61 protected Class resolveProxyClass(String [] interfaces) 62 throws IOException , ClassNotFoundException 63 { 64 ClassLoader loader = Thread.currentThread().getContextClassLoader(); 66 Class [] ifaceClasses = new Class [interfaces.length]; 67 for (int i = 0; i < interfaces.length; i++) 68 { 69 ifaceClasses[i] = loader.loadClass(interfaces[i]); 70 } 71 72 return java.lang.reflect.Proxy.getProxyClass(loader, ifaceClasses); 73 } 74 } 75 | Popular Tags |