org.sapia.clazzy
Class JarClassLoader
java.lang.Object
|
+--java.lang.ClassLoader
|
+--java.security.SecureClassLoader
|
+--org.sapia.clazzy.BaseClassLoader
|
+--org.sapia.clazzy.JarClassLoader
- All Implemented Interfaces:
- Consts
- public class JarClassLoader
- extends BaseClassLoader
- implements Consts
This class overrides the BaseClassLoader class and search
classes in a given jar file. It is provided as an alternative to the
implementation that comes with the JDK, which locks the underlying
jar files (in fact keeping the files open).
Under some OS (WIN!"$D%?), this prevents the jar files from being deleted
(for example, in the case of hot-deployments).
An instance of this class works around this limitation by internally using
a JarLoader instance, which opens the jar file at instantiation
time, and allows closing the said jar file when it is not needed anymore.
Client applications should call close() on an instance of this class to ensure
that the underlying JarLoader is disposed of cleanly (i.e.: that the jar file
it holds is closed).
- Author:
- Yanick Duchesne
- See Also:
JarLoader,
ClazzyURLConnection,
- Copyright:
- Copyright © 2002-2004 Sapia Open
Source Software . All Rights Reserved.
- License:
- Read the license.txt file of the jar or visit the license page at the Sapia
OSS web site
| Methods inherited from class java.lang.ClassLoader |
clearAssertionStatus, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JarClassLoader
public JarClassLoader(File jar)
JarClassLoader
public JarClassLoader(ClassLoader parent,
File jar)
getFile
public File getFile()
- Returns:
- the
File corresponding to the archive in which this
instance looks up.
findClass
protected Class findClass(String name)
throws ClassNotFoundException
- Overrides:
findClass in class ClassLoader
ClassNotFoundException- See Also:
ClassLoader.findClass(java.lang.String)
findResourceAsStream
public InputStream findResourceAsStream(String name)
- Parameters:
name - the name of the resource whose stream should be returned.
- Returns:
- an
InputStream.
findResource
protected URL findResource(String name)
- Overrides:
findResource in class ClassLoader
- See Also:
ClassLoader.findResource(java.lang.String)
close
public void close()
- See Also:
JarLoader.close()
Copyright © 2002 Sapia Open Community, Inc. All Rights Reserved.