| java.lang.Object | |
| ↳ | java.lang.ClassLoader |
Known Direct Subclasses
|
Known Indirect Subclasses
|
A ClassLoader is used for loading classes.
This class must be implemented by the VM. The documented methods and natives must be implemented to support other provided class implementations in this package.
| Protected Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
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.
| |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
Clears the default, package and class assertion status of a classloader
| |||||||||||
Returns the specified ClassLoader's parent.
| |||||||||||
Returns an URL which can be used to access the resource described by
resName, using the class loader's resource lookup algorithm.
| |||||||||||
Returns a stream on a resource found by looking up resName using the
class loader's resource lookup algorithm.
| |||||||||||
Returns an Enumeration of URL which can be used to access the resources
described by resName, using the class loader's resource lookup algorithm.
| |||||||||||
Returns the system class loader.
| |||||||||||
Returns an URL specifying a resource which can be found by looking up
resName using the system class loader's resource lookup algorithm.
| |||||||||||
Returns a stream on a resource found by looking up resName using the
system class loader's resource lookup algorithm.
| |||||||||||
Returns an Enumeration of URLs containing all resources which can be
found by looking up resName using the system class loader's resource
lookup algorithm.
| |||||||||||
Invoked by the Virtual Machine when resolving class references.
| |||||||||||
Sets the assertion status of a class.
| |||||||||||
Sets the default assertion status of a classloader
| |||||||||||
Sets the assertion status of a package.
| |||||||||||
| Protected Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
This method is deprecated.
Use defineClass(String, byte[], int, int)
| |||||||||||
Defines a new class for the name, bytecodes in the byte buffer and the protection domain. | |||||||||||
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.
| |||||||||||
Constructs a new class from an array of bytes containing a class
definition in class file format.
| |||||||||||
Define a new Package using the specified information.
| |||||||||||
Overridden by subclasses, by default throws ClassNotFoundException.
| |||||||||||
Returns the absolute path of the file containing the library associated
with the given name, or null.
| |||||||||||
Attempts to find and return a class which has already been loaded by the
virtual machine.
| |||||||||||
Returns an URL which can be used to access the resource described by
resName, using the class loader's resource lookup algorithm.
| |||||||||||
Returns an Enumeration of URL which can be used to access the resources
described by resName, using the class loader's resource lookup algorithm.
| |||||||||||
Attempts to load a class using the system class loader.
| |||||||||||
Attempt to locate the requested package.
| |||||||||||
Return all the packages known to this class loader.
| |||||||||||
Loads the class with the specified name, optionally linking the class
after load.
| |||||||||||
Forces a class to be linked (initialized).
| |||||||||||
Sets the signers of a class.
| |||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
| |||||||||||
Constructs a new instance of this class with the system class loader as its parent.
| SecurityException | if a security manager exists and it does not allow the creation of new ClassLoaders. |
|---|
Constructs a new instance of this class with the given class loader as its parent.
| parentLoader | The ClassLoader to use as the new class loaders parent. |
|---|
| SecurityException | if a security manager exists and it does not allow the creation of new ClassLoaders. |
|---|---|
| NullPointerException | if the parent is null. |
Clears the default, package and class assertion status of a classloader
Returns the specified ClassLoader's parent.
| SecurityException | if a security manager exists and it does not allow the parent loader to be retrieved. |
|---|
Returns 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.
| resName | String the name of the resource to find. |
|---|
Returns 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.
| resName | String the name of the resource to find. |
|---|
Returns 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.
| resName | String the name of the resource to find. |
|---|
| IOException |
|---|
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.
| SecurityException | if a security manager exists and it does not allow access to the system class loader. |
|---|
Returns an URL specifying a resource which can be found by looking up resName using the system class loader's resource lookup algorithm.
| resName | The name of the resource to find. |
|---|
Returns 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.
| resName | The name of the resource to find. |
|---|
Returns an Enumeration of URLs containing all resources which can be found by looking up resName using the system class loader's resource lookup algorithm.
| resName | String the name of the resource to find. |
|---|
| IOException |
|---|
Invoked by the Virtual Machine when resolving class references. Equivalent to loadClass(className, false);
| className | The name of the class to search for. |
|---|
| ClassNotFoundException | if the class could not be found. |
|---|
Sets the assertion status of a class.
| cname | Class name |
|---|---|
| enable | Enable or disable assertion |
Sets the default assertion status of a classloader
| enable | Enable or disable assertion |
|---|
Sets the assertion status of a package.
| pname | Package name |
|---|---|
| enable | Enable or disable assertion |
This method is deprecated.Use defineClass(String, byte[], int, int)
Constructs a new class from an array of bytes containing a class definition in class file format.
| classRep | A memory image of a class file. |
|---|---|
| offset | The offset into the classRep. |
| length | The length of the class file. |
| ClassFormatError |
|---|
Defines a new class for the name, bytecodes in the byte buffer and the protection domain.
| name | The name of the class to define. |
|---|---|
| b | The byte buffer containing the bytecodes of the new class. |
| protectionDomain | The protection domain this class belongs to. |
| ClassFormatError | if an invalid class file is defined. |
|---|
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.
| className | The name of the new class. |
|---|---|
| classRep | A memory image of a class file. |
| offset | The offset into the classRep. |
| length | The length of the class file. |
| protectionDomain | The protection domain this class should belongs to. |
| ClassFormatError |
|---|
Constructs a new class from an array of bytes containing a class definition in class file format.
| className | The name of the new class |
|---|---|
| classRep | A memory image of a class file |
| offset | The offset into the classRep |
| length | The length of the class file |
| ClassFormatError |
|---|
Define a new Package using the specified information.
| name | The name of the package |
|---|---|
| specTitle | The title of the specification for the Package |
| specVersion | The version of the specification for the Package |
| specVendor | The vendor of the specification for the Package |
| implTitle | The implementation title of the Package |
| implVersion | The implementation version of the Package |
| implVendor | The specification vendor of the Package |
| sealBase | If sealBase is null, the package is left unsealed. Otherwise, the the package is sealed using this URL. |
| IllegalArgumentException | if the Package already exists |
|---|
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.
| className | The name of the class to search for. |
|---|
| ClassNotFoundException | if the class cannot be found. |
|---|
Returns 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".
| libName | The name of the library to find. |
|---|
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.
| className | The name of the class to search for. |
|---|
Returns 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.
| resName | The name of the resource to find. |
|---|
Returns 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.
| resName | The name of the resource to find. |
|---|
| IOException | when an error occurs |
|---|
Attempts to load a class using the system class loader. Note that the class has already been been linked.
| className | The name of the class to search for. |
|---|
| ClassNotFoundException | if the class cannot be found. |
|---|
Attempt to locate the requested package. If no package information can be located, null is returned.
| name | The name of the package to find |
|---|
Return all the packages known to this class loader.
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
| className | The name of the class to search for. |
|---|---|
| resolve | Indicates if class should be resolved after loading. Note: On the android reference implementation this parameter does not have any effect. |
| ClassNotFoundException | if the class could not be found. |
|---|
Forces a class to be linked (initialized). If the class has already been linked this operation has no effect. Note that for the android reference implementation this method does not have any effect.
| clazz | The Class to link. |
|---|
| NullPointerException | if clazz is null. |
|---|
Sets the signers of a class.
| c | The Class object |
|---|---|
| signers | The signers for the class |