Methods Summary |
---|
public void | append(ClassPathElement anElement)Append a class path element to the classpath.
if (theClassPath == null)
theClassPath = anElement;
else
theClassPath.append(anElement);
|
public void | append(java.io.File directory)Append a directory to the classpath.
append(ClassPathElement.create(directory.getPath()));
|
public static java.lang.String | classNameOf(java.lang.String fileName)Return the vm class name which corresponds to the input file name.
The file name is expected to be a "./" relative path.
Returns null if the file name doesn't end in ".class"
int fnlen = fileName.length();
if (fnlen > 6 && fileName.regionMatches(true, fnlen - 6, ".class", 0, 6)) {//NOI18N
/* the file name ends with .class */
fileName = fileName.substring(0, fileName.length()-6);
StringBuffer className = new StringBuffer();
StringTokenizer parser = new StringTokenizer(fileName, "\\/", false);//NOI18N
for (boolean first = true; parser.hasMoreElements(); first = false) {
if (!first)
className.append('/");
className.append(parser.nextToken());
}
return className.toString();
}
return null;
|
public java.util.Enumeration | classesInPackage(java.lang.String packageName)Return an enumeration of all of the class files in the specified
package in this class path.
return new ClassPackageEnumeration(this, packageName);
|
public static java.lang.String | fileNameOf(java.lang.String className, char separator)Return a file name which might reasonably identify a file containing
the specified class. The name is a "./" relative path.
StringBuffer path = new StringBuffer();
StringTokenizer parser = new StringTokenizer(className, "./", false);//NOI18N
for (boolean first = true; parser.hasMoreElements(); first = false) {
if (!first)
path.append(separator);
path.append(parser.nextToken());
}
path.append(".class");//NOI18N
return path.toString();
|
public static java.lang.String | fileNameOf(java.lang.String className)Return a file name which might reasonably identify a file containing
the specified class. The name is a "./" relative path.
return fileNameOf(className, File.separatorChar);
|
public ClassFileSource | findClass(java.lang.String className)locate a class file given a fully qualified class name
return findClass(className, theClassPath);
|
static ClassFileSource | findClass(java.lang.String className, ClassPathElement path)locate a class file given a fully qualified class name
starting at the specified class path element
for (ClassPathElement e = path; e != null; e = e.next()) {
ClassFileSource source = e.sourceOf(className);
if (source != null) {
source.setSourceElement(e);
return source;
}
}
return null;
|
ClassPathElement | getPathElements()
return theClassPath;
|
private void | parsePath()
StringTokenizer parser =
new StringTokenizer(theClassPathSpec,
java.io.File.pathSeparator,
false /* dont return delimiters */
);
ClassPathElement lastElement = null;
while (parser.hasMoreElements()) {
ClassPathElement anElement = ClassPathElement.create(parser.nextToken());
if (lastElement == null)
theClassPath = anElement;
else
lastElement.append(anElement);
lastElement = anElement;
}
|
public boolean | remove(java.io.File directory)Remove any class path elements which match directory
boolean matched = false;
ClassPathElement firstElement = theClassPath;
ClassPathElement prevElement = null;
for (ClassPathElement cpe = firstElement; cpe != null; cpe = cpe.next()) {
if (cpe.matches(directory)) {
matched = true;
if (prevElement == null)
firstElement = cpe.next();
else
prevElement.setNext(cpe.next());
} else {
prevElement = cpe;
}
}
theClassPath = firstElement;
return matched;
|
public static java.lang.String | zipFileNameOf(java.lang.String className)Return a file name which might reasonably identify a file containing
the specified class in a zip file.
return fileNameOf(className, '/");
|