All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class pnuts.ext.JarClassLoader

pnuts.ext.JarClassLoader

public class JarClassLoader
This classloader can read JAR files dynamically. jarClassLoader.pnut is a sample script in Pnuts. Besides, after this class is loaded, jar URL can be used as defined in JDK1.2. For example, URL("jar:http://www.etale.com/pnuts/pnuts.jar!/lib/init.pnut").


Variable Index

 o classes
 o resources

Constructor Index

 o JarClassLoader()

Method Index

 o getLoader(Object)
 o getResource(String)
URL scheme for a resource in a JAR file is:
 o getResourceAsStream(String)
Get an InputStream on a given resource.
 o loadClass(String, boolean)
Resolves the specified name to a Class.
 o loadJar(String)
Load a JAR file specified with the filename.
 o loadJar(URL)
Load a JAR file from the specified URL.
 o loadJar(ZipFile)
 o loadJar(ZipInputStream)
Load a JAR file through ZipInputStream.

Variables

 o classes
 public Hashtable classes
 o resources
 public Hashtable resources

Constructors

 o JarClassLoader
 public JarClassLoader()

Methods

 o getLoader
 public static JarClassLoader getLoader(Object key)
 o loadJar
 public void loadJar(URL url) throws IOException
Load a JAR file from the specified URL.

 o loadJar
 public void loadJar(ZipInputStream zin) throws IOException
Load a JAR file through ZipInputStream. The contents of entries are kept in a hashtable (, so this operation is heavy weight). When JAR file is randomly accessible, use loadJar(String filename).

 o loadJar
 public void loadJar(String filename) throws IOException
Load a JAR file specified with the filename. The corresponding ZipFile object is kept in a hashtable.

 o loadJar
 protected void loadJar(ZipFile file) throws IOException
 o loadClass
 public Class loadClass(String name,
                        boolean resolve) throws ClassNotFoundException
Resolves the specified name to a Class. The method loadClass() is called by the virtual machine.

If the resolve flag is true, the method should call the resolveClass method on the resulting class object.

Parameters:
name - the name of the desired Class.
resolve - true if the Class needs to be resolved.
Returns:
the resulting Class, or null if it was not found.
Throws: ClassNotFoundException
if the class loader cannot find a definition for the class.
 o getResource
 public URL getResource(String name)
URL scheme for a resource in a JAR file is:

 o getResourceAsStream
 public InputStream getResourceAsStream(String name)
Get an InputStream on a given resource. Will return null if no resource with this name is found.

Parameters:
name - the name of the resource, to be used as is.
Returns:
an InputStream on the resource, or null if not found.

All Packages  Class Hierarchy  This Package  Previous  Next  Index