|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
public class 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.
| Nested Class Summary | |
|---|---|
(package private) static class |
URLClassLoader.SubURLClassLoader
|
| Field Summary | |
|---|---|
(package private) HashMap<URL,URL[]> |
extensions
|
(package private) Hashtable<String,URL[]>[] |
indexes
|
(package private) Set<URL> |
invalidUrls
|
(package private) URL[] |
orgUrls
|
(package private) URL[] |
urls
|
| Constructor Summary | |
|---|---|
URLClassLoader(URL[] urls)
Constructs a new instance of this class. |
|
URLClassLoader(URL[] urls,
ClassLoader parent)
Constructs a new instance of this class. |
|
URLClassLoader(URL[] searchUrls,
ClassLoader parent,
URLStreamHandlerFactory factory)
Constructs a new instance of this class. |
|
| Method Summary | |
|---|---|
protected void |
addURL(URL url)
Adds the specified URL to the search list. |
(package private) URL[] |
addURL(URL[] urlArray,
URL url)
Returns an array with the given URL added to the given array. |
protected Package |
definePackage(String packageName,
Manifest manifest,
URL url)
Define a new Package using information extracted from the specified Manifest. |
(package private) URL[] |
explore(URL url,
int indexNumber)
|
protected Class<?> |
findClass(String clsName)
Locates and loads the specified class, searching this URLClassLoader's list of URLS. |
(package private) Class<?> |
findClassImpl(URL[] searchURLs,
String clsName)
|
(package private) Object |
findInExtensions(URL[] newExtensions,
String name,
int i,
Vector<URL> resources,
boolean url)
Returns an Object[] containing a Class, a URL, and a Vector of URLs, 2 of which are null, according to the caller, which is identified by the int type. |
(package private) Object |
findInIndex(int i,
String name,
Vector<URL> resources,
boolean url)
Returns an Object[] containing a Class, a URL, and a Vector of URLs, 2 of which are null, according to the caller, which is identified by the int type. |
URL |
findResource(String name)
Returns a URL referencing the specified resource or null if no resource could be found. |
(package private) URL |
findResourceImpl(URL[] searchList,
String resName)
Returns a URL among the given ones referencing the specified resource or null if no resource could be found. |
Enumeration<URL> |
findResources(String name)
Returns an enumeration of URLs that contain the specified resource. |
(package private) Vector<URL> |
findResources(URL[] searchURLs,
String name,
Vector<URL> result)
Returns a Vector of URLs among the given ones that contain the specified resource. |
protected PermissionCollection |
getPermissions(CodeSource codesource)
Returns the permissions for the given code source. |
URL[] |
getURLs()
Returns the search list of this URLClassLoader |
static URLClassLoader |
newInstance(URL[] urls)
Returns an instance of URLClassLoader. |
static URLClassLoader |
newInstance(URL[] urls,
ClassLoader parentCl)
Returns an instance of URLClassLoader. |
| Methods inherited from class java.security.SecureClassLoader |
|---|
defineClass, defineClass |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
URL[] urls
URL[] orgUrls
Set<URL> invalidUrls
HashMap<URL,URL[]> extensions
Hashtable<String,URL[]>[] indexes
| Constructor Detail |
|---|
public URLClassLoader(URL[] urls)
urls - the URLs to search
SecurityException - if a security manager exists and its checkCreateClassLoader
method doesn't allow creation of new ClassLoaders
public URLClassLoader(URL[] urls,
ClassLoader parent)
urls - the URLs to searchparent - the ClassLoader to assign as this loader's parent.
SecurityException - if a security manager exists and its checkCreateClassLoader
method doesn't allow creation of new ClassLoaders
public URLClassLoader(URL[] searchUrls,
ClassLoader parent,
URLStreamHandlerFactory factory)
searchUrls - java.net.URL[] the URLs that will be searched in the order
they were specified for resourceparent - ClassLoader the ClassLoader name of the resource to find.factory - java.net.URLStreamHandlerFactory the factory that will used to
create stream (protocol) handlers
SecurityException - if a security manager exists and its checkCreateClassLoader
method doesn't allow creation of new ClassLoaders| Method Detail |
|---|
protected void addURL(URL url)
url - java.net.URL the new URL
URL[] addURL(URL[] urlArray,
URL url)
urlArray - java.net.URL[] the source arrayurl - java.net.URL the URL to be added
public Enumeration<URL> findResources(String name)
throws IOException
findResources in class ClassLoadername - java.lang.String the name of the requested resource
IOException - thrown if an IO Exception occurs while attempting to connect
Vector<URL> findResources(URL[] searchURLs,
String name,
Vector<URL> result)
searchURLs - java.net.URL[] the array to be searchedname - java.lang.String the name of the requested resource
Object findInIndex(int i,
String name,
Vector<URL> resources,
boolean url)
i - int the index of 'indexes' array to use.name - String the resource to look for : either a resource or a
class.resources - boolean indicates that a Vector of URL should be returned as
the non-null element in Object[].url - boolean if true a URL should be returned as the non null
element, if false a Class should be returned.
Object findInExtensions(URL[] newExtensions,
String name,
int i,
Vector<URL> resources,
boolean url)
newExtensions - URL[] the URLs to look in for.name - String the resource to look for : either a resource or a
class.i - int the index of 'indexes' array to use.resources - boolean indicates that a Vector of URL should be returned as
the non-null element in Object[].url - boolean if true a URL should be returned as the non null
element, if false a Class should be returned.
protected PermissionCollection getPermissions(CodeSource codesource)
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.
getPermissions in class SecureClassLoadercodesource - CodeSource
public URL[] getURLs()
public static URLClassLoader newInstance(URL[] urls)
URLClassLoader.
loadClass() of the new instance will call the
SecurityManager's checkPackageAccess() before loading a
class.
urls - java.net.URL[] a list of URLs that is passed to the new
URLClassloader
URLClassLoader
public static URLClassLoader newInstance(URL[] urls,
ClassLoader parentCl)
URLClassLoader.
loadClass() of the new instance will call security
manager's checkPackageAccess() before loading a class.
urls - URL[] the list of URLs that is passed to the new
URLClassloaderparentCl - ClassLoader the parent class loader that is passed to the new
URLClassloader
URLClassLoader
protected Class<?> findClass(String clsName)
throws ClassNotFoundException
findClass in class ClassLoaderclsName - String the name of the class.
ClassNotFoundException - if the class cannot be loadedpublic URL findResource(String name)
findResource in class ClassLoadername - java.lang.String the name of the requested resource
URL findResourceImpl(URL[] searchList,
String resName)
searchList - java.net.URL[] the array to be searchedresName - java.lang.String the name of the requested resource
protected Package definePackage(String packageName,
Manifest manifest,
URL url)
throws IllegalArgumentException
packageName - The name of the packagemanifest - The Manifest for the Packageurl - The code source for the Package
IllegalArgumentException - if the Package already exists
Class<?> findClassImpl(URL[] searchURLs,
String clsName)
searchURLs - java.net.URL[] the URLs to search inclsName - java.lang.String the class name to be found
URL[] explore(URL url,
int indexNumber)
url - URL the URL to exploreindexNumber - int the index in extensions to consider
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||