The documented methods and natives must be implemented to support other provided class implementations in this package. ClassLoaders are used to dynamically load, link and install classes into a running image.
Public Member Functions | |
final ClassLoader | getParent () |
Returns the specified ClassLoader's parent. | |
URL | getResource (String resName) |
Answers an URL which can be used to access the resource described by resName, using the class loader's resource lookup algorithm. | |
final Enumeration | getResources (String resName) throws IOException |
Answers an Enumeration of URL which can be used to access the resources described by resName, using the class loader's resource lookup algorithm. | |
InputStream | getResourceAsStream (String resName) |
Answers a stream on a resource found by looking up resName using the class loader's resource lookup algorithm. | |
Class | loadClass (String className) throws ClassNotFoundException |
Invoked by the Virtual Machine when resolving class references. | |
void | setClassAssertionStatus (String cname, boolean enable) |
Sets the assertion status of a class. | |
void | setPackageAssertionStatus (String pname, boolean enable) |
Sets the assertion status of a package. | |
void | setDefaultAssertionStatus (boolean enable) |
Sets the default assertion status of a classloader. | |
void | clearAssertionStatus () |
Clears the default, package and class assertion status of a classloader. | |
Static Public Member Functions | |
static ClassLoader | getSystemClassLoader () |
Returns the system class loader. | |
static URL | getSystemResource (String resName) |
Answers an URL specifing a resource which can be found by looking up resName using the system class loader's resource lookup algorithm. | |
static Enumeration | getSystemResources (String resName) throws IOException |
Answers an Emuneration of URL containing all resources which can be found by looking up resName using the system class loader's resource lookup algorithm. | |
static InputStream | getSystemResourceAsStream (String resName) |
Answers a stream on a resource found by looking up resName using the system class loader's resource lookup algorithm. | |
Protected Member Functions | |
ClassLoader () | |
Constructs a new instance of this class with the system class loader as its parent. | |
ClassLoader (ClassLoader parentLoader) | |
Constructs a new instance of this class with the given class loader as its parent. | |
final Class | defineClass (byte[] classRep, int offset, int length) throws ClassFormatError |
Constructs a new class from an array of bytes containing a class definition in class file format. | |
final Class | defineClass (String className, byte[] classRep, int offset, int length) throws ClassFormatError |
Constructs a new class from an array of bytes containing a class definition in class file format. | |
final Class | defineClass (String className, byte[] classRep, int offset, int length, ProtectionDomain protectionDomain) throws java.lang.ClassFormatError |
Constructs a new class from an array of bytes containing a class definition in class file format and assigns the new class to the specified protection domain. | |
Class | findClass (String className) throws ClassNotFoundException |
Overridden by subclasses, by default throws ClassNotFoundException. | |
final Class | findLoadedClass (String className) |
Attempts to find and return a class which has already been loaded by the virtual machine. | |
final Class | findSystemClass (String className) throws ClassNotFoundException |
Attempts to load a class using the system class loader. | |
Class | loadClass (String className, boolean resolveClass) throws ClassNotFoundException |
Loads the class with the specified name, optionally linking the class after load. | |
final void | resolveClass (Class clazz) |
Forces a class to be linked (initialized). | |
URL | findResource (String resName) |
Answers an URL which can be used to access the resource described by resName, using the class loader's resource lookup algorithm. | |
Enumeration | findResources (String resName) throws IOException |
Answers an Enumeration of URL which can be used to access the resources described by resName, using the class loader's resource lookup algorithm. | |
String | findLibrary (String libName) |
Answers the absolute path of the file containing the library associated with the given name, or null. | |
Package | getPackage (String name) |
Attempt to locate the requested package. | |
Package[] | getPackages () |
Return all the packages known to this class loader. | |
Package | definePackage (String name, String specTitle, String specVersion, String specVendor, String implTitle, String implVersion, String implVendor, URL sealBase) throws IllegalArgumentException |
Define a new Package using the specified information. | |
final void | setSigners (Class c, Object[] signers) |
Sets the signers of a class. | |
Package Functions | |
final boolean | isSystemClassLoader () |
This method must be provided by the vm vendor, as it is used by other provided class implementations in this package. | |
final boolean | isAncestorOf (ClassLoader child) |
Answers true if the receiver is ancestor of another class loader. | |
final Object[] | getSigners (Class c) |
Gets the signers of a class. | |
boolean | getClassAssertionStatus (String cname) |
Answers the assertion status of the named class Returns the assertion status of the class or nested class if it has been set. | |
boolean | getPackageAssertionStatus (String pname) |
Answers the assertion status of the named package Returns the assertion status of the named package or superpackage if that has been set. | |
boolean | getDefaultAssertionStatus () |
Answers the default assertion status. | |
Static Package Functions | |
static final void | initializeClassLoaders () |
static final ClassLoader | getStackClassLoader (int depth) |
This must be provided by the vm vendor. | |
static ClassLoader | callerClassLoader () |
This method must be included, as it is used by System.load(), System.loadLibrary(). | |
static void | loadLibraryWithClassLoader (String libName, ClassLoader loader) |
This method must be provided by the vm vendor, as it is called by java.lang.System.loadLibrary(). | |
static void | loadLibraryWithPath (String libName, ClassLoader loader, String libraryPath) |
This method must be provided by the vm vendor, as it is called by java.lang.System.load(). | |
Static Package Attributes | |
static ClassLoader | systemClassLoader |
|
Constructs a new instance of this class with the system class loader as its parent.
|
|
Constructs a new instance of this class with the given class loader as its parent.
|
|
Constructs a new class from an array of bytes containing a class definition in class file format.
|
|
Constructs a new class from an array of bytes containing a class definition in class file format.
|
|
Constructs a new class from an array of bytes containing a class definition in class file format and assigns the new class to the specified protection domain.
|
|
Overridden by subclasses, by default throws ClassNotFoundException. This method is called by loadClass() after the parent ClassLoader has failed to find a loaded class of the same name.
|
|
Attempts to find and return a class which has already been loaded by the virtual machine. Note that the class may not have been linked and the caller should call resolveClass() on the result if necessary.
|
|
Attempts to load a class using the system class loader. Note that the class has already been been linked.
|
|
Returns the specified ClassLoader's parent.
|
|
Answers an URL which can be used to access the resource described by resName, using the class loader's resource lookup algorithm. The default behavior is just to return null.
|
|
Answers an Enumeration of URL which can be used to access the resources described by resName, using the class loader's resource lookup algorithm. The default behavior is just to return an empty Enumeration.
|
|
Answers a stream on a resource found by looking up resName using the class loader's resource lookup algorithm. The default behavior is just to return null.
|
|
Returns the system class loader. This is the parent for new ClassLoader instances, and is typically the class loader used to start the application. If a security manager is present, and the caller's class loader is not null and the caller's class loader is not the same as or an ancestor of the system class loader, then this method calls the security manager's checkPermission method with a RuntimePermission("getClassLoader") permission to ensure it's ok to access the system class loader. If not, a SecurityException will be thrown.
|
|
Answers an URL specifing a resource which can be found by looking up resName using the system class loader's resource lookup algorithm.
|
|
Answers an Emuneration of URL containing all resources which can be found by looking up resName using the system class loader's resource lookup algorithm.
|
|
Answers a stream on a resource found by looking up resName using the system class loader's resource lookup algorithm. Basically, the contents of the java.class.path are searched in order, looking for a path which matches the specified resource.
|
|
Invoked by the Virtual Machine when resolving class references. Equivalent to loadClass(className, false);
|
|
Loads the class with the specified name, optionally linking the class after load. Steps are: 1) Call findLoadedClass(className) to determine if class is loaded 2) Call loadClass(className, resolveClass) on the parent loader. 3) Call findClass(className) to find the class
|
|
Forces a class to be linked (initialized). If the class has already been linked this operation has no effect.
|
|
This method must be provided by the vm vendor, as it is used by other provided class implementations in this package. A sample implementation of this method is provided by the reference implementation. This method is used by SecurityManager.classLoaderDepth(), currentClassLoader() and currentLoadedClass(). Answers true if the receiver is a system class loader. Note that this method has package visibility only. It is defined here to avoid the security manager check in getSystemClassLoader, which would be required to implement this method anywhere else.
|
|
Answers true if the receiver is ancestor of another class loader. Note that this method has package visibility only. It is defined here to avoid the security manager check in getParent, which would be required to implement this method anywhere else.
|
|
Answers an URL which can be used to access the resource described by resName, using the class loader's resource lookup algorithm. The default behavior is just to return null. This should be implemented by a ClassLoader.
|
|
Answers an Enumeration of URL which can be used to access the resources described by resName, using the class loader's resource lookup algorithm. The default behavior is just to return an empty Enumeration.
|
|
Answers the absolute path of the file containing the library associated with the given name, or null. If null is answered, the system searches the directories specified by the system property "java.library.path".
|
|
Attempt to locate the requested package. If no package information can be located, null is returned.
|
|
Return all the packages known to this class loader.
|
|
Define a new Package using the specified information.
|
|
Gets the signers of a class.
|
|
Sets the signers of a class.
|
|
This must be provided by the vm vendor.
It is used by SecurityManager.checkMemberAccess() with depth = 3. Note that checkMemberAccess() assumes the following stack when called.
|
|
This method must be included, as it is used by System.load(), System.loadLibrary(). The reference implementation of this method uses the getStackClassLoader() method. Returns the ClassLoader of the method that called the caller. i.e. A.x() calls B.y() calls callerClassLoader(), A's ClassLoader will be returned. Returns null for the bootstrap ClassLoader.
|
|
This method must be provided by the vm vendor, as it is called by java.lang.System.loadLibrary(). System.loadLibrary() cannot call Runtime.loadLibrary() because this method loads the library using the ClassLoader of the calling method. Loads and links the library specified by the argument.
|
|
This method must be provided by the vm vendor, as it is called by java.lang.System.load(). System.load() cannot call Runtime.load() because the library is loaded using the ClassLoader of the calling method. Loads and links the library specified by the argument. No security check is done.
|
|
Sets the assertion status of a class.
|
|
Sets the assertion status of a package.
|
|
Sets the default assertion status of a classloader.
|
|
Clears the default, package and class assertion status of a classloader.
|
|
Answers the assertion status of the named class Returns the assertion status of the class or nested class if it has been set. Otherwise returns the assertion status of its package or superpackage if that has been set. Otherwise returns the default assertion status. Returns 1 for enabled and 0 for disabled.
|
|
Answers the assertion status of the named package Returns the assertion status of the named package or superpackage if that has been set. Otherwise returns the default assertion status. Returns 1 for enabled and 0 for disabled.
|
|
Answers the default assertion status.
|