|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.ClassLoader | +--com.dalsemi.system.classloader.TINIClassLoader
A simple ClassLoader
implementation that can be used
by applications to load classes stored in files in the classpath.
This class also provides some utility class loading methods, such
as class unloading and returning the class path.
Constructor Summary | |
TINIClassLoader()
Creates a new TINIClassLoader that can be used to load class files from the file system. |
Method Summary | |
static void |
addDynamicClass(byte[] code,
int cnum)
Adds bytes representing a TINI Class File as a dynamically loaded class. |
static void |
addTrashHeap(byte[] heap,
int cnum,
java.lang.ClassLoader cl)
Adds bytes representing a TINI Class File's reflection information, referred to as the Trash Heap. |
static java.util.StringTokenizer |
getClasspath()
Returns the classpath pre-pended by the 'boot' classpath. |
java.lang.Class |
loadClass(java.lang.String classname,
boolean resolve_it)
Definition of the loadClass method to override the
abstract declaration in java.lang.ClassLoader . |
static void |
unloadClasses(java.lang.ClassLoader cl)
Provides a mechanism for applications to remove the memory associated with classes loaded by a certain java.lang.ClassLoader object. |
Methods inherited from class java.lang.ClassLoader |
defineClass,
defineClass,
findLoadedClass,
findSystemClass,
getResource,
getResourceAsStream,
getSystemResource,
getSystemResourceAsStream,
loadClass,
resolveClass,
setSigners |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public TINIClassLoader()
Method Detail |
public java.lang.Class loadClass(java.lang.String classname, boolean resolve_it) throws java.lang.ClassNotFoundException
loadClass
method to override the
abstract declaration in java.lang.ClassLoader
.
Note that the resolve_it
argument is always ignored.
The class is always resolved.classname
- class name to resolve to a java.lang.Class
fileresolve_it
- ignored, the class is always resolvedpublic static java.util.StringTokenizer getClasspath()
StringTokenizer st = getClasspath();
while (st.hasMoreElements())
{
String path = st.nextToken();
file = new File(path, classname+".class");
if (file.exists())
{
break;
}
file = null;
}
Currently the 'boot' classpath is /tiniext, and is similar to
[JDK]/jre/lib/ext on PC implementations of the Java Virtual Machine.public static void addDynamicClass(byte[] code, int cnum)
code
- buffer containing the converted class filecnum
- class number for this new classpublic static void addTrashHeap(byte[] heap, int cnum, java.lang.ClassLoader cl)
code
- buffer containing the converted reflection informationcnum
- class number taht this reflection information belongs tocl
- java.lang.ClassLoader object used to load this classpublic static void unloadClasses(java.lang.ClassLoader cl)
Provides a mechanism for applications to remove the memory associated with classes loaded by a certain java.lang.ClassLoader object. Since finalizers do not work on TINI, this method is exposed to try to reclaim space consumed by the code and reflection information of a set of classes.
NOTE: This function does expose some possible dangerous behavior. Once
the ClassLoader
has been unloaded, the application will become
unstable if it tries to use:
cl
- all classes loaded by this java.lang.ClassLoader object will be unloaded,
any memory associated with these classes will be released, even if instances
of this Object or its java.lang.Class Object still exist
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |