Methods Summary |
---|
public static void | createDirectory(java.lang.String path)Given a path string create all the directories in the path. For example,
if the path string is "java/applet", the method will create directory
"java" and then "java/applet" if they don't exist. The file separator
string "/" is platform dependent system property.
if (path == null || path.length() == 0) {
return;
}
File dir = new File(path);
try {
if (dir.exists()) {
return;
} else {
if (dir.mkdirs()) {
return;
} else {
HtmlDocWriter.configuration.message.error(
"doclet.Unable_to_create_directory_0", path);
throw new DocletAbortException();
}
}
} catch (SecurityException exc) {
exc.printStackTrace();
System.exit(1);
} catch (DocletAbortException exc) {
exc.printStackTrace();
System.exit(1);
}
|
public static java.lang.String | createPathString(com.sun.javadoc.PackageDoc pd)Given a PackageDoc, return its URL path string.
if (pd == null) {
return "";
}
return getPath(pd.name());
|
public static java.lang.String | createPathString(com.sun.javadoc.ClassDoc cd)Given a ClassDoc, return its URL path string.
if (cd == null) {
return "";
}
PackageDoc pd = cd.containingPackage();
return (pd == null)? "": getPath(pd.name());
|
public static java.lang.String | getBackPath(java.lang.String path)Given a URL path string, this will return the reverse path. For
example, if the URL path string is "java/lang" the method will return
URL specific string "../".
if (path == null || path.length() == 0) {
return "";
}
StringBuffer backpath = new StringBuffer();
for (int i = 0; i < path.length(); i++) {
char ch = path.charAt(i);
if (ch == '/") {
backpath.append("..");
backpath.append(urlfileseparator);
} // there is always a trailing fileseparator
}
return backpath.toString();
|
public static java.lang.String | getDirectoryPath(com.sun.javadoc.PackageDoc pd)Given a PackageDoc, return the directory name. If name of the package
is "java.lang" then path will be "java/lang". If name of the package is
"no_interior_dot" then path will be just "no_interior_dot". The file
separator used is a platform dependent file separator.
if (pd == null) {
return "";
}
String name = pd.name();
StringBuffer pathstr = new StringBuffer();
for (int i = 0; i < name.length(); i++) {
char ch = name.charAt(i);
if (ch == '.") {
pathstr.append(fileseparator);
} else {
pathstr.append(ch);
}
}
return pathstr.toString();
|
public static java.lang.String | getPath(java.lang.String name)Given any string, return the URL path string. For example, if the string
is "com.sun.javadoc" then the URL path string will be "com/sun/javadoc"
The URL path separator "/"(which is not platform specific) is used to
separate the directory names.
if (name == null || name.length() == 0) {
return "";
}
StringBuffer pathstr = new StringBuffer();
for (int i = 0; i < name.length(); i++) {
char ch = name.charAt(i);
if (ch == '.") {
pathstr.append(urlfileseparator);
} else {
pathstr.append(ch);
}
}
return pathstr.toString();
|
public static java.lang.String | getPathToClass(com.sun.javadoc.ClassDoc cd)Given a class name return the full path to the class file.
For example, if ClassDoc passed is for "java.lang.Object" then the
string returned is "java/lang/Object.html".
return getPathToPackage(cd.containingPackage(), cd.name() + ".html");
|
public static java.lang.String | getPathToPackage(com.sun.javadoc.PackageDoc pd, java.lang.String filename)Given a package name and a file name, return the full path to that file.
For example, if PackageDoc passed is for "java.lang" and the filename
passed is "package-summary.html", then the string returned is
"java/lang/package-summary.html".
StringBuffer buf = new StringBuffer();
String pathstr = createPathString(pd);
if (pathstr.length() > 0) {
buf.append(pathstr);
buf.append("/");
}
buf.append(filename);
return buf.toString();
|
public static java.lang.String | getRelativePath(java.lang.String from, java.lang.String to)Given two strings/(package names) return the relative path from one
string to another. For example, if the parameter string "from" is
"java.lang" and parameter string "to" is "java.applet" the method will
return string "../../java/applet". The relative path returned is URL
specific, and hence it uses "/" as file separator.
StringBuffer pathstr = new StringBuffer();
pathstr.append(getRelativePath(from));
pathstr.append(getPath(to));
pathstr.append(urlfileseparator);
return pathstr.toString();
|
public static java.lang.String | getRelativePath(java.lang.String from)Given string(package name), return relative path string. For example,
if the string "from" is "java.lang" the method will return "../../"
relative path, till the directory, in which is output is getting
generated. The returned string is URL specific. String from is nothing
but the directory location
if (from == null || from.length() == 0) {
return "";
}
StringBuffer pathstr = new StringBuffer();
for (int i = 0; i < from.length(); i++) {
char ch = from.charAt(i);
if (ch == '.") {
pathstr.append(".." + urlfileseparator);
}
}
pathstr.append(".." + urlfileseparator);
return pathstr.toString();
|