Get Bounce at SourceForge.net. Fast secure and Free Open Source software downloads

org.bounce
Class JarClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by java.security.SecureClassLoader
          extended by org.bounce.JarClassLoader

public class JarClassLoader
extends java.security.SecureClassLoader

A class loader for loading resources and classes out of a jar file. Overrides the findClass and the findResource methods.

Version:
$Revision: 1.5 $, $Date: 2008/01/28 21:28:37 $
Author:
Edwin Dankert

Constructor Summary
JarClassLoader(java.lang.ClassLoader parent, java.net.URL url)
          Creates a new JarClassLoader that will allow the loading of classes stored in the jar file supplied.
JarClassLoader(java.net.URL url)
          Creates a new JarClassLoader that will allow the loading of classes stored in the jar file supplied.
 
Method Summary
 java.lang.Class findClass(java.lang.String name)
          Checks the contents table for an occurence of the class.
 java.net.URL findResource(java.lang.String name)
          Checks the contents table for an occurence of the resource file.
 
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass, getPermissions
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JarClassLoader

public JarClassLoader(java.net.URL url)
               throws java.io.IOException
Creates a new JarClassLoader that will allow the loading of classes stored in the jar file supplied. It uses the system class loader as the parent classloader.

Parameters:
url - the URL of the jar file
Throws:
java.io.IOException - an error happened while reading the contents of the jar file.

JarClassLoader

public JarClassLoader(java.lang.ClassLoader parent,
                      java.net.URL url)
               throws java.io.IOException
Creates a new JarClassLoader that will allow the loading of classes stored in the jar file supplied.

Parameters:
parent - the parent classloader.
url - the URL of the jar file
Throws:
java.io.IOException - an error happened while reading the contents of the jar file.
Method Detail

findClass

public java.lang.Class findClass(java.lang.String name)
                          throws java.lang.ClassNotFoundException
Checks the contents table for an occurence of the class.

Overrides:
findClass in class java.lang.ClassLoader
Parameters:
name - the name of the class.
Returns:
the class found for the name.
Throws:
java.lang.ClassNotFoundException - the jar file did not contain the class.

findResource

public java.net.URL findResource(java.lang.String name)
Checks the contents table for an occurence of the resource file.

Overrides:
findResource in class java.lang.ClassLoader
Parameters:
name - the name of the resource.
Returns:
The url of the resource or null if not found.

Get Bounce at SourceForge.net. Fast secure and Free Open Source software downloads

Copyright 2002-2002-2009 Edwin Dankert. All Rights Reserved.