net.groboclown.util.classes.v1.jdk2
Class UrlClassLoader

java.lang.Object
  |
  +--net.groboclown.util.classes.v1.jdk2.UrlClassLoader
All Implemented Interfaces:
IUrlClassLoader

public class UrlClassLoader
extends Object
implements IUrlClassLoader

A JDK 1.2+ URL Class Loader implementation.

Version:
Alpha 0.9.0
Author:
Matt Albrecht

Field Summary
private  Hashtable m_urlLoaders
           
 
Constructor Summary
UrlClassLoader()
          Default constructor
 
Method Summary
protected  URL convertUrl(String url)
          Converts the given string to a fully qualified URL.
 void flush()
          Call to flush any cache stored in the interface.
protected  URLClassLoader getClassLoader(URL url)
           
 Class loadClass(String className, String url)
          Load the given class from the given URL.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

m_urlLoaders

private Hashtable m_urlLoaders
Constructor Detail

UrlClassLoader

public UrlClassLoader()
Default constructor
Method Detail

loadClass

public Class loadClass(String className,
                       String url)
Load the given class from the given URL. If the URL is null, then it is up to the classloader to figure out where to load it from. This should, in general, load the class from the default class loader.
Specified by:
loadClass in interface IUrlClassLoader
Parameters:
className - the exact class name to load.
url - the URL from which the class is loaded. If this is null, then the returned class is implementation specific.
Returns:
the loaded Class instance, or null if the class could not be found or if the given URL is not valid.

flush

public void flush()
Call to flush any cache stored in the interface. This allows for a class loader to cache results, and free up memory when it is not needed.
Specified by:
flush in interface IUrlClassLoader

convertUrl

protected URL convertUrl(String url)
Converts the given string to a fully qualified URL. If no scheme is given, then it is converted to a File scheme.

getClassLoader

protected URLClassLoader getClassLoader(URL url)


Written under the LGPL