Methods Summary |
---|
public byte[] | getBytes(java.lang.String name)
return getBytes(name, ".class");
|
public byte[] | getBytes(java.lang.String name, java.lang.String suffix)
InputStream is = getInputStream(name, suffix);
if(is == null)
throw new IOException("Couldn't find: " + name + suffix);
DataInputStream dis = new DataInputStream(is);
byte[] bytes = new byte[is.available()];
dis.readFully(bytes);
dis.close(); is.close();
return bytes;
|
public com.sun.org.apache.bcel.internal.util.ClassPath$ClassFile | getClassFile(java.lang.String name, java.lang.String suffix)
for(int i=0; i < paths.length; i++) {
ClassFile cf;
if((cf = paths[i].getClassFile(name, suffix)) != null)
return cf;
}
throw new IOException("Couldn't find: " + name + suffix);
|
public com.sun.org.apache.bcel.internal.util.ClassPath$ClassFile | getClassFile(java.lang.String name)
return getClassFile(name, ".class");
|
private static final java.lang.String | getClassPath()
String class_path = System.getProperty("java.class.path");
String boot_path = System.getProperty("sun.boot.class.path");
String ext_path = System.getProperty("java.ext.dirs");
ArrayList list = new ArrayList();
getPathComponents(class_path, list);
getPathComponents(boot_path, list);
ArrayList dirs = new ArrayList();
getPathComponents(ext_path, dirs);
for(Iterator e = dirs.iterator(); e.hasNext(); ) {
File ext_dir = new File((String)e.next());
String[] extensions = ext_dir.list(new FilenameFilter() {
public boolean accept(File dir, String name) {
name = name.toLowerCase();
return name.endsWith(".zip") || name.endsWith(".jar");
}
});
if(extensions != null)
for(int i=0; i < extensions.length; i++)
list.add(ext_path + File.separatorChar + extensions[i]);
}
StringBuffer buf = new StringBuffer();
for(Iterator e = list.iterator(); e.hasNext(); ) {
buf.append((String)e.next());
if(e.hasNext())
buf.append(File.pathSeparatorChar);
}
return buf.toString();
|
public java.io.InputStream | getInputStream(java.lang.String name)
return getInputStream(name, ".class");
|
public java.io.InputStream | getInputStream(java.lang.String name, java.lang.String suffix)
return getClassFile(name, suffix).getInputStream();
|
public java.lang.String | getPath(java.lang.String name)
int index = name.lastIndexOf('.");
String suffix = "";
if(index > 0) {
suffix = name.substring(index);
name = name.substring(0, index);
}
return getPath(name, suffix);
|
public java.lang.String | getPath(java.lang.String name, java.lang.String suffix)
return getClassFile(name, suffix).getPath();
|
private static final void | getPathComponents(java.lang.String path, java.util.ArrayList list)
if(path != null) {
StringTokenizer tok = new StringTokenizer(path, File.pathSeparator);
while(tok.hasMoreTokens()) {
String name = tok.nextToken();
File file = new File(name);
if(file.exists())
list.add(name);
}
}
|