net.sourceforge.groboutils.util.classes.v1.jdk2
Class UrlClassLoader

java.lang.Object
  extended bynet.sourceforge.groboutils.util.classes.v1.jdk2.UrlClassLoader
All Implemented Interfaces:
IUrlClassLoader

public class UrlClassLoader
extends java.lang.Object
implements IUrlClassLoader

A JDK 1.2+ URL Class Loader implementation.

New in version 1.0.0: This will attempt to load from the thread's context loader if the URL is bad.

Since:
November 17, 2000 (GroboUtils Alpha 0.9.0)
Version:
$Date: 2003/05/06 05:35:01 $
Author:
Matt Albrecht groboclown@users.sourceforge.net

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

Constructor Detail

UrlClassLoader

public UrlClassLoader()
Default constructor

Method Detail

loadClass

public java.lang.Class loadClass(java.lang.String className,
                                 java.lang.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 java.net.URL convertUrl(java.lang.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 java.lang.ClassLoader getClassLoader(java.net.URL url)


Copyright © 2001-2003 by The GroboUtils Project