com.ibm.security12.sun.misc
Class URLClassPath

java.lang.Object
  |
  +--com.ibm.security12.sun.misc.URLClassPath

public class URLClassPath
extends Object

This class is used to maintain a search path of URLs for loading classes and resources from both JAR files and directories.

Version:
1.49, 09/02/98
Author:
David Connelly

Constructor Summary
URLClassPath(URL[] urls)
           
URLClassPath(URL[] urls, URLStreamHandlerFactory factory)
          Creates a new URLClassPath for the given URLs.
 
Method Summary
 void addURL(URL url)
          Appends the specified URL to the search path of directory and JAR file URLs from which to load classes and resources.
 Resource getResource(String name)
           
 Resource getResource(String name, boolean check)
          Finds the first Resource on the URL search path which has the specified name.
 Enumeration getResources(String name)
           
 Enumeration getResources(String name, boolean check)
          Finds all resources on the URL search path with the given name.
 URL[] getURLs()
          Returns the original search path of URLs.
static URL[] pathToURLs(String path)
          Convert class path specification into an array of file URLs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLClassPath

public URLClassPath(URL[] urls,
                    URLStreamHandlerFactory factory)
Creates a new URLClassPath for the given URLs. The URLs will be searched in the order specified for classes and resources. A URL ending with a '/' is assumed to refer to a directory. Otherwise, the URL is assumed to refer to a JAR file.
Parameters:
urls - the directory and JAR file URLs to search for classes and resources
factory - the URLStreamHandlerFactory to use when creating new URLs

URLClassPath

public URLClassPath(URL[] urls)
Method Detail

addURL

public void addURL(URL url)
Appends the specified URL to the search path of directory and JAR file URLs from which to load classes and resources.

getURLs

public URL[] getURLs()
Returns the original search path of URLs.

getResource

public Resource getResource(String name,
                            boolean check)
Finds the first Resource on the URL search path which has the specified name. Returns null if no Resource could be found.
Parameters:
name - the name of the Resource
Returns:
the Resource, or null if not found

getResource

public Resource getResource(String name)

getResources

public Enumeration getResources(String name,
                                boolean check)
Finds all resources on the URL search path with the given name. Returns an enumeration of the Resource objects.
Parameters:
name - the resource name
Returns:
an Enumeration of all the resources having the specified name

getResources

public Enumeration getResources(String name)

pathToURLs

public static URL[] pathToURLs(String path)
Convert class path specification into an array of file URLs.