java.lang.Object | |||
↳ | java.lang.ClassLoader | ||
↳ | java.security.SecureClassLoader | ||
↳ | java.net.URLClassLoader |
This class loader is responsible for loading classes and resources from a
list of URLs which can refer to either directories or JAR files. Classes
loaded by this
URLClassLoader
are granted permission to access the
URLs contained in the URL search list.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Constructs a new
URLClassLoader
instance.
|
||||||||||
|
Constructs a new URLClassLoader instance.
|
||||||||||
|
Constructs a new
URLClassLoader
instance.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Returns an URL referencing the specified resource or
null
if the
resource could not be found.
|
||||||||||
|
Returns all known URLs which point to the specified resource.
|
||||||||||
|
Returns the search list of this
URLClassLoader
.
|
||||||||||
|
Returns a new
URLClassLoader
instance for the given URLs and the
specified
ClassLoader
as its parent.
|
||||||||||
|
Returns a new
URLClassLoader
instance for the given URLs and the
system
ClassLoader
as its parent.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Adds the specified URL to the search list.
|
||||||||||
|
Defines a new package using the information extracted from the specified
manifest.
|
||||||||||
|
Tries to locate and load the specified class using the known URLs.
|
||||||||||
|
Gets all permissions for the specified
codesource
.
|
[Expand]
Inherited Methods
|
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.security.SecureClassLoader
|
|||||||||||
From class
java.lang.ClassLoader
|
|||||||||||
From class
java.lang.Object
|
Constructs a new
URLClassLoader
instance. The newly created
instance will have the system ClassLoader as its parent. URLs that end
with "/" are assumed to be directories, otherwise they are assumed to be
JAR files.
urls | the list of URLs where a specific class or file could be found. |
---|
Constructs a new URLClassLoader instance. The newly created instance will have the system ClassLoader as its parent. URLs that end with "/" are assumed to be directories, otherwise they are assumed to be JAR files.
urls | the list of URLs where a specific class or file could be found. |
---|---|
parent | the class loader to assign as this loader's parent. |
Constructs a new
URLClassLoader
instance. The newly created
instance will have the specified
ClassLoader
as its parent and
use the specified factory to create stream handlers. URLs that end with
"/" are assumed to be directories, otherwise they are assumed to be JAR
files.
searchUrls | the list of URLs where a specific class or file could be found. |
---|---|
parent |
the
ClassLoader
to assign as this loader's parent.
|
factory | the factory that will be used to create protocol-specific stream handlers. |
Returns an URL referencing the specified resource or
null
if the
resource could not be found.
name | the name of the requested resource. |
---|
Returns all known URLs which point to the specified resource.
name | the name of the requested resource. |
---|
IOException | if an I/O error occurs while attempting to connect. |
---|
Returns the search list of this
URLClassLoader
.
Returns a new
URLClassLoader
instance for the given URLs and the
specified
ClassLoader
as its parent.
urls | the list of URLs that is passed to the new URLClassLoader. |
---|---|
parentCl | the parent class loader that is passed to the new URLClassLoader. |
URLClassLoader
instance.
Returns a new
URLClassLoader
instance for the given URLs and the
system
ClassLoader
as its parent.
urls |
the list of URLs that is passed to the new
URLClassLoader
.
|
---|
URLClassLoader
instance.
Adds the specified URL to the search list.
url | the URL which is to add. |
---|
Defines a new package using the information extracted from the specified manifest.
packageName | the name of the new package. |
---|---|
manifest | the manifest containing additional information for the new package. |
url | the URL to the code source for the new package. |
IllegalArgumentException | if a package with the given name already exists. |
---|
Tries to locate and load the specified class using the known URLs. If the class could be found, a class object representing the loaded class will be returned.
className | the name of the class to look for. |
---|
Class
object that is found.
ClassNotFoundException | if the specified class cannot be loaded. |
---|
Gets all permissions for the specified
codesource
. First, this
method retrieves the permissions from the system policy. If the protocol
is "file:/" then a new permission,
FilePermission
, granting the
read permission to the file is added to the permission collection.
Otherwise, connecting to and accepting connections from the URL is
granted.
codesource | the code source object whose permissions have to be known. |
---|