1 3 package org.python.core; 4 import java.io.*; 5 import java.util.*; 6 import java.security.*; 7 8 11 class BytecodeLoader2 extends SecureClassLoader implements Loader { 12 private Vector parents; 13 14 public BytecodeLoader2() { 15 parents = BytecodeLoader.init(); 16 } 17 18 public void addParent(ClassLoader referent) { 19 if (!parents.contains(referent)) 20 parents.addElement(referent); 21 } 22 23 protected Class loadClass(String name, boolean resolve) 25 throws ClassNotFoundException 26 { 27 Class c = findLoadedClass(name); 28 if (c != null) 29 return c; 30 return BytecodeLoader.findParentClass(parents, name); 31 } 32 33 34 public Class loadClassFromBytes(String name, byte[] data) { 35 Class c = defineClass(name, data, 0, data.length, 36 this.getClass().getProtectionDomain()); 37 resolveClass(c); 38 BytecodeLoader.compileClass(c); 39 return c; 40 } 41 42 } 43 | Popular Tags |