|
mjc | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.multijava.util.classfile.ClassPath
This class implements the conceptual directory structure for .class files
| Nested Class Summary | |
static class |
ClassPath.ClassDescription
A File value used to indicate an undefined result. |
static class |
ClassPath.Data
This class mimics a DataInput, but optimizes the reading of the supplied InputStream. |
static class |
ClassPath.FileClassDescription
|
| Field Summary | |
private static java.util.HashMap |
allLoadedFile
|
private static java.util.HashMap |
allLocatedSourceFiles
|
private static java.lang.String |
bootclasspath
Holder for the user set boot class path; if null, the system value of the boot class path is used. |
private ClassDirectory[] |
dirs
|
private static java.lang.String |
finalclasspath
Holder for the combined classpath and bootclasspath. |
private static java.lang.String[] |
javasuffix
Returns a ClassDescription for the java file containing the class with the given name; returns null if can't be found. |
private static java.lang.String |
lastClassPath
The classPath argument that was used to construct self. |
private static java.lang.String |
lastSourcePath
The sourcePath argument that was used to construct self. |
private static ClassPath.ClassDescription |
NO_CLASS_DESC
A ClassDescription value used to indicate that the is no file and no class description available. |
private static ClassPath |
self
A reference to the singleton instance of this class. |
private ClassDirectory[] |
sourceDirs
|
| Constructor Summary | |
private |
ClassPath(java.lang.String classPath,
java.lang.String sourcePath)
Constructs the class path. |
| Method Summary | |
static java.lang.String |
classPath()
Returns the combined classpath and bootclasspath. |
static java.lang.String |
findPackage(java.lang.String name)
Returns the root directory (on the CLASSPATH) in which the given package can be found. |
private java.lang.String |
findPackageLocation(java.lang.String name)
Returns a String indicating the location of a package. |
static java.lang.String |
findPackageSource(java.lang.String name)
Returns the root directory in the sourcepath in which the given '.' separated package is found, or null if the package cannot be found. |
private java.lang.String |
findPackageSourceLocation(java.lang.String name)
Returns the root directory in the sourcepath in which the given '.' separated package is found. |
private ClassPath.ClassDescription |
findSourceFile(java.lang.String name,
java.lang.String[] suffixes)
This function returns the first file found that has one of the given suffixes and is in the sourceDirs directory path. |
private ClassPath.ClassDescription |
getClassFile(java.lang.String name,
java.lang.String suffix)
Returns a class file but don't read it or cache it. |
static ClassInfo |
getClassInfo(java.lang.String name,
boolean interfaceOnly)
Creates a class info object by reading bytecode from the file named name.class. |
static ClassInfo |
getClassInfo(java.lang.String name,
java.lang.String suffix,
ClassInfoCreator creator,
boolean markNotFound,
boolean interfaceOnly)
Creates a class info object by reading bytecode from the file named name.suffix. |
static ClassPath.ClassDescription |
getClassPathFile(java.lang.String name)
Returns a ClassDescription for the class file containing the class with the given name (searching each directory on the classpath in turn); returns null if can't be found. |
static ClassPath.ClassDescription |
getClassPathFile(java.lang.String name,
java.lang.String suffix)
|
static ClassPath.ClassDescription |
getFile(java.lang.String name,
java.lang.String suffix)
Returns a ClassDescription for the file with the given name+suffix; returns null if can't be found. |
static ClassPath.ClassDescription |
getJavaFile(java.lang.String name)
|
static ClassPath.ClassDescription |
getSourceFile(java.lang.String name,
java.lang.String[] suffixes)
Returns a ClassDescription for the source file containing the class with the given name and one of the given suffixes (searching for any suffix in each directory on the sourcepath in turn); returns null if can't be found. |
static void |
init(java.lang.String classPath,
java.lang.String sourcePath)
Initialization from strings that represents the class path and the source path (if sourcePath is null, classPath is used for both files searches). |
static void |
initSession()
Prepares for a new compilation session by forgetting the locations of known files (since the CLASSPATH and SOURCEPATH may be different for the new session). |
static ClassDirectory[] |
parseClassPath(java.lang.String classPath)
|
static void |
setBootClassPath(java.lang.String b)
Sets the boot classpath (in palce of the default, which is the system classpath. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
private static java.lang.String[] javasuffix
private static ClassPath self
private static java.lang.String lastClassPath
self. Stored to avoid instantiating a new
singleton when it would have the same state as the old one.
private static java.lang.String lastSourcePath
self. Stored to avoid instantiating a new
singleton when it would have the same state as the old one.
private static java.util.HashMap allLoadedFile
private static java.util.HashMap allLocatedSourceFiles
private ClassDirectory[] dirs
private ClassDirectory[] sourceDirs
private static ClassPath.ClassDescription NO_CLASS_DESC
private static java.lang.String bootclasspath
private static java.lang.String finalclasspath
| Constructor Detail |
private ClassPath(java.lang.String classPath,
java.lang.String sourcePath)
| Method Detail |
public static ClassDirectory[] parseClassPath(java.lang.String classPath)
public static void init(java.lang.String classPath,
java.lang.String sourcePath)
classPath - the classpath (used for finding .class files)sourcePath - the sourcepath (used for finding .java and other source files)public static void setBootClassPath(java.lang.String b)
public static java.lang.String classPath()
public static ClassPath.ClassDescription getJavaFile(java.lang.String name)
public static ClassPath.ClassDescription getSourceFile(java.lang.String name,
java.lang.String[] suffixes)
public static ClassPath.ClassDescription getFile(java.lang.String name,
java.lang.String suffix)
public static ClassPath.ClassDescription getClassPathFile(java.lang.String name)
public static ClassPath.ClassDescription getClassPathFile(java.lang.String name,
java.lang.String suffix)
public static ClassInfo getClassInfo(java.lang.String name,
boolean interfaceOnly)
throws ClassFileReadException
name.class.
name - the name of the classinterfaceOnly - read the signature, but not the code, of
the class if true
ClassFileReadException - if the class file is
malformed or an I/O error occurs
public static ClassInfo getClassInfo(java.lang.String name,
java.lang.String suffix,
ClassInfoCreator creator,
boolean markNotFound,
boolean interfaceOnly)
throws ClassFileReadException
name.suffix. If the argument
creator is not null, use it to create a class info
object; otherwise creates an instance of the class ClassInfo.
name - the name of the classsuffix - the file suffix to look forcreator - a factory, or nullmarkNotFound - if true, then track files already checkedinterfaceOnly - read the signature, but not the code, of
the class if true
ClassFileReadException - if the class file is
malformed or an I/O error occurspublic static java.lang.String findPackage(java.lang.String name)
public static java.lang.String findPackageSource(java.lang.String name)
private java.lang.String findPackageLocation(java.lang.String name)
private java.lang.String findPackageSourceLocation(java.lang.String name)
private ClassPath.ClassDescription getClassFile(java.lang.String name,
java.lang.String suffix)
private ClassPath.ClassDescription findSourceFile(java.lang.String name,
java.lang.String[] suffixes)
public static void initSession()
|
mjc | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||