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