harpoon.ClassFile
Class Loader

java.lang.Object
  extended by harpoon.ClassFile.Loader

public abstract class Loader
extends Object

Class file loader. Looks through CLASSPATH to find resources. Understands .jar and .zip files. Platform-independent (hopefully).

Version:
$Id: Loader.java,v 1.18 2005/08/09 21:06:49 salcianu Exp $
Author:
C. Scott Ananian <cananian@alumni.princeton.edu>

Field Summary
static HCodeFactory systemCodeFactory
          System code factory: this code factory will return bytecode representations for classes loaded via the system linker.
static Linker systemLinker
          System-linker: the class names resolved by this linker are always immutable and identical to those on disk.
static boolean VERBOSE
           
 
Constructor Summary
Loader()
           
 
Method Summary
static Iterator classpaths()
          Iterate over the components of the system CLASSPATH.
static String classToResource(String classname)
          Translate a class name into a corresponding resource name.
static InputStream getResourceAsStream(String name)
          Open an InputStream on a resource found somewhere in the CLASSPATH.
static Iterator listClasses(String packagename)
          Returns an iterator of Strings naming the available classes in the given package which are on the classpath.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERBOSE

public static boolean VERBOSE

systemLinker

public static final Linker systemLinker
System-linker: the class names resolved by this linker are always immutable and identical to those on disk.


systemCodeFactory

public static final HCodeFactory systemCodeFactory
System code factory: this code factory will return bytecode representations for classes loaded via the system linker.

Constructor Detail

Loader

public Loader()
Method Detail

classpaths

public static final Iterator classpaths()
Iterate over the components of the system CLASSPATH. Each element is a String naming one segment of the CLASSPATH.


classToResource

public static String classToResource(String classname)
Translate a class name into a corresponding resource name.

Parameters:
classname - The class name to translate.

getResourceAsStream

public static InputStream getResourceAsStream(String name)
Open an InputStream on a resource found somewhere in the CLASSPATH.

Parameters:
name - The filename of the resource to locate.

listClasses

public static Iterator listClasses(String packagename)
Returns an iterator of Strings naming the available classes in the given package which are on the classpath.