2009-12-03 02:08:29 +00:00
|
|
|
/* Copyright (c) 2008-2009, Avian Contributors
|
2008-02-19 18:06:52 +00:00
|
|
|
|
|
|
|
Permission to use, copy, modify, and/or distribute this software
|
|
|
|
for any purpose with or without fee is hereby granted, provided
|
|
|
|
that the above copyright notice and this permission notice appear
|
|
|
|
in all copies.
|
|
|
|
|
|
|
|
There is NO WARRANTY for this software. See license.txt for
|
|
|
|
details. */
|
|
|
|
|
2009-05-26 03:36:29 +00:00
|
|
|
package avian;
|
2007-07-30 23:19:05 +00:00
|
|
|
|
2007-08-10 23:45:47 +00:00
|
|
|
import java.net.URL;
|
|
|
|
import java.net.MalformedURLException;
|
|
|
|
|
2007-07-30 23:19:05 +00:00
|
|
|
public class SystemClassLoader extends ClassLoader {
|
2010-09-01 16:13:52 +00:00
|
|
|
private static native VMClass findVMClass(String name)
|
|
|
|
throws ClassNotFoundException;
|
|
|
|
|
|
|
|
protected Class findClass(String name) throws ClassNotFoundException {
|
|
|
|
return getClass(findVMClass(name));
|
|
|
|
}
|
2007-07-30 23:19:05 +00:00
|
|
|
|
2010-09-10 21:05:29 +00:00
|
|
|
public static native Class getClass(VMClass vmClass);
|
|
|
|
|
2010-09-01 16:13:52 +00:00
|
|
|
private static native VMClass findLoadedVMClass(String name);
|
|
|
|
|
|
|
|
protected Class reallyFindLoadedClass(String name){
|
|
|
|
VMClass c = findLoadedVMClass(name);
|
|
|
|
return c == null ? null : getClass(c);
|
|
|
|
}
|
2007-08-10 23:45:47 +00:00
|
|
|
|
2010-09-01 16:13:52 +00:00
|
|
|
private static native boolean resourceExists(String name);
|
2007-08-10 23:45:47 +00:00
|
|
|
|
|
|
|
protected URL findResource(String name) {
|
|
|
|
if (resourceExists(name)) {
|
|
|
|
try {
|
2007-08-19 19:45:51 +00:00
|
|
|
return new URL("resource:" + name);
|
2007-08-10 23:45:47 +00:00
|
|
|
} catch (MalformedURLException ignored) { }
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
2007-07-30 23:19:05 +00:00
|
|
|
}
|