|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
ptolemy.backtrack.util.ClassFileLoader
public class ClassFileLoader
Class loader that tries to load a class from the given file. This class loader, unlike other class loaders that accept class names and load classes with those names, accepts class file names and loads them as classes. It uses defineClass(java.lang.String, sun.misc.Resource) in URLClassLoader to define the class with the contents in the given file. If error occurs, it falls back to traditional class loading with the class name in the exception message.
Red (tfeng) |
Red (tfeng) |
Constructor Summary | |
---|---|
ClassFileLoader()
Construct a class loader with no special class path. |
|
ClassFileLoader(java.lang.String[] classPaths)
Construct a class loader with a set of class paths specified as a string array. |
Method Summary | |
---|---|
java.lang.Class |
loadClass(java.io.File classFile)
Load a class defined in a file, and return the Class object of
the class. |
Methods inherited from class java.net.URLClassLoader |
---|
addURL, definePackage, findClass, findResource, findResources, getPermissions, getURLs, newInstance, newInstance |
Methods inherited from class java.security.SecureClassLoader |
---|
defineClass, defineClass |
Methods inherited from class java.lang.ClassLoader |
---|
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ClassFileLoader() throws java.net.MalformedURLException
java.net.MalformedURLException
- If a string is not a proper URL.public ClassFileLoader(java.lang.String[] classPaths) throws java.net.MalformedURLException
classPaths
- The array of class paths to be searched in order.
java.net.MalformedURLException
- If a string is not a proper URL.Method Detail |
---|
public java.lang.Class loadClass(java.io.File classFile) throws java.io.FileNotFoundException, java.io.IOException, java.lang.LinkageError, java.lang.ClassNotFoundException
Class
object of
the class.
classFile
- The file that defines the class.
java.io.FileNotFoundException
- If the file cannot be found.
java.io.IOException
- If error occurs when trying to read the file.
java.lang.LinkageError
- If URLClassLoader.defineClass(java.lang.String, sun.misc.Resource)
issues a LinkageError
and fails to define the class.
java.lang.ClassNotFoundException
- If some classes referenced by the
class in the file cannot be found.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |