1 52 53 package com.go.trove.classfile; 54 55 import java.io.*; 56 57 65 public class ResourceClassFileDataLoader implements ClassFileDataLoader { 66 private final ClassLoader mLoader; 67 68 71 public ResourceClassFileDataLoader() { 72 mLoader = getClass().getClassLoader(); 73 } 74 75 79 public ResourceClassFileDataLoader(ClassLoader loader) { 80 mLoader = loader; 81 } 82 83 public InputStream getClassData(String name) { 84 name = name.replace('.', '/') + ".class"; 85 86 InputStream in; 87 if (mLoader == null) { 88 in = ClassLoader.getSystemResourceAsStream(name); 89 } 90 else { 91 in = mLoader.getResourceAsStream(name); 92 } 93 94 return in; 95 } 96 } 97 | Popular Tags |