|
JML | ||||||||||
| 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 HashMap |
allLoadedFile
|
private static HashMap |
allLocatedSourceFiles
|
private static 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 String |
finalclasspath
Holder for the combined classpath and bootclasspath. |
private static 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 String |
lastClassPath
The classPath argument that was used to construct self. |
private static 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(String classPath,
String sourcePath)
Constructs the class path. |
| Method Summary | |
static String |
classPath()
Returns the combined classpath and bootclasspath. |
static String |
findPackage(String name)
Returns the root directory (on the CLASSPATH) in which the given package can be found. |
private String |
findPackageLocation(String name)
Returns a String indicating the location of a package. |
static String |
findPackageSource(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 String |
findPackageSourceLocation(String name)
Returns the root directory in the sourcepath in which the given '.' separated package is found. |
private ClassPath.ClassDescription |
findSourceFile(String name,
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(String name,
String suffix)
Returns a class file but don't read it or cache it. |
static ClassInfo |
getClassInfo(String name,
boolean interfaceOnly)
Creates a class info object by reading bytecode from the file named name.class. |
static ClassInfo |
getClassInfo(String name,
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(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(String name,
String suffix)
|
static ClassPath.ClassDescription |
getFile(String name,
String suffix)
Returns a ClassDescription for the file with the given name+suffix; returns null if can't be found. |
static ClassPath.ClassDescription |
getJavaFile(String name)
|
static ClassPath.ClassDescription |
getSourceFile(String name,
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(String classPath,
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(String classPath)
|
static void |
setBootClassPath(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 String[] javasuffix
private static ClassPath self
private static String lastClassPath
self. Stored to avoid instantiating a new
singleton when it would have the same state as the old one.
private static String lastSourcePath
self. Stored to avoid instantiating a new
singleton when it would have the same state as the old one.
private static HashMap allLoadedFile
private static HashMap allLocatedSourceFiles
private ClassDirectory[] dirs
private ClassDirectory[] sourceDirs
private static ClassPath.ClassDescription NO_CLASS_DESC
private static String bootclasspath
private static String finalclasspath
| Constructor Detail |
private ClassPath(String classPath,
String sourcePath)
| Method Detail |
public static ClassDirectory[] parseClassPath(String classPath)
public static void init(String classPath,
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(String b)
public static String classPath()
public static ClassPath.ClassDescription getJavaFile(String name)
public static ClassPath.ClassDescription getSourceFile(String name,
String[] suffixes)
public static ClassPath.ClassDescription getFile(String name,
String suffix)
public static ClassPath.ClassDescription getClassPathFile(String name)
public static ClassPath.ClassDescription getClassPathFile(String name,
String suffix)
public static ClassInfo getClassInfo(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(String name,
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 String findPackage(String name)
public static String findPackageSource(String name)
private String findPackageLocation(String name)
private String findPackageSourceLocation(String name)
private ClassPath.ClassDescription getClassFile(String name,
String suffix)
private ClassPath.ClassDescription findSourceFile(String name,
String[] suffixes)
public static void initSession()
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||