net.sf.jmp3renamer
Class JarClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by net.sf.jmp3renamer.JarClassLoader

public class JarClassLoader
extends ClassLoader

This ClassLoader is designed for plugin-based applications. The main design goal is the possibility to close the jarfile, so that it can be deleted or replaced by newer ones.


Field Summary
private  Hashtable cache
           
private  JarFile jar
           
 
Constructor Summary
JarClassLoader(File jar)
           
JarClassLoader(String jar)
           
 
Method Summary
private  String classToFile(String name)
           
 void closeJarFile()
           
protected  Class findClass(String clazz)
           
 InputStream getResourceAsStream(String resource)
           
private  Class loadClassFromJar(String clazz)
           
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, 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
 

Field Detail

jar

private JarFile jar

cache

private Hashtable cache
Constructor Detail

JarClassLoader

public JarClassLoader(String jar)
               throws IOException
Throws:
IOException

JarClassLoader

public JarClassLoader(File jar)
               throws IOException
Throws:
IOException
Method Detail

closeJarFile

public void closeJarFile()
                  throws IOException
Throws:
IOException

findClass

protected Class findClass(String clazz)
                   throws ClassNotFoundException
Overrides:
findClass in class ClassLoader
Throws:
ClassNotFoundException

loadClassFromJar

private Class loadClassFromJar(String clazz)

getResourceAsStream

public InputStream getResourceAsStream(String resource)
Overrides:
getResourceAsStream in class ClassLoader

classToFile

private String classToFile(String name)