Methods Summary |
---|
public java.lang.Class | defineClassTest(byte[] b, int off, int len)
return defineClass(b, off, len);
|
private byte[] | getBytes(java.lang.String filename)
File file = new File( filename );
long len = file.length();
byte raw[] = new byte[(int)len];
FileInputStream fin = new FileInputStream( file );
int r = fin.read( raw );
if (r != len)
throw new IOException( "Can't read all, "+r+" != "+len );
fin.close();
return raw;
|
public java.lang.Package | getPackage(java.lang.String name)
return super.getPackage(name);
|
public java.lang.Package[] | getPackages()
return super.getPackages();
|
public java.io.InputStream | getResourceAsStream(java.lang.String name)
return getClass().getResourceAsStream("/" + getClass().getPackage().
getName().replace(".", "/") + "/" + name);
|
public java.lang.Class | loadClass(java.lang.String name, boolean resolve)
Class clazz = findLoadedClass(name);
String classFileName = name.replace( '.", '/" ) + ".class";
File classFile = new File(classFileName);
if (classFile.exists()) {
try {
byte raw[] = getBytes(classFileName);
clazz = defineClass( name, raw, 0, raw.length );
} catch(Exception ioe) {}
}
if (clazz == null) {
Package p = getClass().getPackage();
InputStream is = getResourceAsStream("/" + classFileName);
byte[] buf = new byte[512];
int len;
try {
len = is.read(buf);
clazz = defineClass(name, buf, 0, len);
} catch (IOException e) {
}
}
if (clazz == null) {
clazz = findSystemClass(name);
}
if(clazz == null)
throw new ClassNotFoundException(name);
return clazz;
|