|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.sun.tdk.signaturetest.classpath.ClasspathImpl
public class ClasspathImpl
ClasspathImpl provides access to all classes placed inside directories and/or jar-files listed in the classpath, which is given to the constructor for new ClasspathImpl instance.
The constructor searches every
directory or jar-file listed and keeps corresponding ClasspathEntry
element, which can provide access to a bytecode for each class found inside
the directory or jar-file. All classes found inside the listed directories
and jar-files are virtually enumerated in the same order as they are found.
The methods
nextClassName() and
setListToBegin() provide access to this classes enumeration.
Also, the method
findClass(name) provides access to class directly by its
qualified name. Note however, that the names class must belong to some
directory or zip-file pointed to the ClasspathImpl instance.
ClasspathEntry| Constructor Summary | |
|---|---|
ClasspathImpl(java.lang.String classPath)
This constructor finds all classes within the given classpath, and creates a list of ClasspathEntry iterator - one element per each directory or zip-file found. |
|
| Method Summary | |
|---|---|
void |
close()
Free resources used (if any) or do nothing. |
protected ClasspathEntry |
createPathEntry(ClasspathEntry previosEntry,
java.lang.String name)
Check if the given name is directory or zip-file name, and create either new DirectoryEntry or new JarFileEntry instance correspondingly. |
java.io.InputStream |
findClass(java.lang.String name)
Returns FileInputStream instance providing bytecode for the required class. |
int |
getNumErrors()
Return number of significand errors occurred when ClasspathImpl constructor was being working. |
boolean |
hasNext()
|
void |
init(java.lang.String classPath)
Initialize the module with given parameter: classPath. |
boolean |
isEmpty()
|
java.lang.String |
nextClassName()
Search next class in the enumeration of classes found inside directories and jar-files pointed to this ClasspathImpl instance. |
void |
printErrors(java.io.PrintWriter out)
Report about all errors occurred while construction of ClasspathImpl. |
void |
setListToBegin()
Reset list of directories and/or zip-files found by ClasspathImpl. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ClasspathImpl(java.lang.String classPath)
classPath - Path string listing directories and/or zip files.
java.lang.SecurityException - The classPath string has invalid
format.findClass(String),
nextClassName(),
setListToBegin(),
createPathEntry(ClasspathEntry, String)| Method Detail |
|---|
public void init(java.lang.String classPath)
ClasspathclassPath.
init in interface ClasspathclassPath - parameter provided to initialize module (usually a
directory or file classPath).public void close()
Classpath
close in interface Classpathpublic boolean isEmpty()
public void printErrors(java.io.PrintWriter out)
out - Where to println error messages.public int getNumErrors()
createPathEntry(ClasspathEntry, String)public void setListToBegin()
nextClassName(),
getCurrentClass(), or
findClass(name).
setListToBegin in interface ClasspathnextClassName(),
findClass(String)public boolean hasNext()
hasNext in interface Classpathpublic java.lang.String nextClassName()
this ClasspathImpl instance. You may invoke
setListToBegin() method to restore classes enumeration to
its starting point.
nextClassName in interface ClasspathsetListToBegin(),
findClass(String)
public java.io.InputStream findClass(java.lang.String name)
throws java.io.IOException,
java.lang.ClassNotFoundException
this ClasspathImpl instance.
findClass in interface Classpathname - Qualified name of the class requested.
java.lang.ClassNotFoundException - Not found in any ClasspathEntry in this
ClasspathImpl instance.
java.io.IOExceptionFileInputStream
protected ClasspathEntry createPathEntry(ClasspathEntry previosEntry,
java.lang.String name)
name - Qualified name of some directory or zip file.
name.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||