1 15 16 package javassist; 17 18 import java.io.InputStream ; 19 import java.net.URL ; 20 21 44 public class ClassClassPath implements ClassPath { 45 private Class thisClass; 46 47 53 public ClassClassPath(Class c) { 54 thisClass = c; 55 } 56 57 ClassClassPath() { 58 66 this(java.lang.Object .class); 67 } 68 69 72 public InputStream openClassfile(String classname) { 73 String jarname = "/" + classname.replace('.', '/') + ".class"; 74 return thisClass.getResourceAsStream(jarname); 75 } 76 77 82 public URL find(String classname) { 83 String jarname = "/" + classname.replace('.', '/') + ".class"; 84 return thisClass.getResource(jarname); 85 } 86 87 90 public void close() { 91 } 92 93 public String toString() { 94 return thisClass.getName() + ".class"; 95 } 96 } 97 | Popular Tags |