Methods Summary |
---|
static java.lang.String | adjustEndFileSeparator(java.lang.String url)If the URL or Directory path is missing end file separator, add that.
String filesep = isRelativePath(url)? File.separator: "/";
if (!url.endsWith(filesep)) {
url += filesep;
}
return url;
|
static java.lang.String | composeExternPackageList(java.lang.String url, java.lang.String pkglisturl)Adjusts the end file separator if it is missing from the URL or the
directory path and depending upon the URL or file path, it fetches or
reads the "package-list" file.
url = adjustEndFileSeparator(url);
pkglisturl = adjustEndFileSeparator(pkglisturl);
if (pkglisturl.startsWith("http://") ||
pkglisturl.startsWith("file:")) {
return fetchURLComposeExternPackageList(url, pkglisturl);
} else {
return readFileComposeExternPackageList(url, pkglisturl);
}
|
static java.lang.String | fetchURLComposeExternPackageList(java.lang.String urlpath, java.lang.String pkglisturlpath)Fetch the URL and read the "package-list" file.
String link = pkglisturlpath + "package-list";
try {
boolean relative = isRelativePath(urlpath);
readPackageList((new URL(link)).openStream(), urlpath, relative);
} catch (MalformedURLException exc) {
return getText("doclet.MalformedURL", link);
} catch (IOException exc) {
return getText("doclet.URL_error", link);
}
return null;
|
public static com.sun.tools.doclets.standard.Extern | findPackage(java.lang.String pkgName)Get the "Extern" object associated with this package name.
if (packageMap == null) {
return null;
}
return (Extern)packageMap.get(pkgName);
|
private static java.lang.String | getText(java.lang.String prop, java.lang.String link)Retrieve the text from the resource bundle.
return Standard.configuration().standardmessage.getText(prop, link);
|
private static java.lang.String | getText(java.lang.String msg)Retrieve the text from the resource bundle.
return Standard.configuration().standardmessage.getText(msg);
|
static boolean | isRelativePath(java.lang.String url)Return true if it's a relative file path and does not start with
"http://" or "file:" string.
return !(url.startsWith("http://") || url.startsWith("file:"));
|
static java.lang.String | readFileComposeExternPackageList(java.lang.String urlpath, java.lang.String relpath)Read the "package-list" file which is available locally.
String link = relpath + "package-list";
try {
File file = new File(link);
if (file.exists() && file.canRead()) {
boolean relative = isRelativePath(urlpath);
readPackageList(new FileInputStream(file), urlpath, relative);
} else {
return getText("doclet.File_error", link);
}
} catch (FileNotFoundException exc) {
return getText("doclet.File_error", link);
} catch (IOException exc) {
return getText("doclet.File_error", link);
}
return null;
|
static void | readPackageList(java.io.InputStream input, java.lang.String path, boolean relative)Read the file "package-list" and for each package name found, create
Extern object and associate it with the package name in the map.
InputStreamReader in = new InputStreamReader(input);
StringBuffer strbuf = new StringBuffer();
try {
int c;
while ((c = in.read()) >= 0) {
char ch = (char)c;
if (ch == '\n" || ch == '\r") {
if (strbuf.length() > 0) {
String packname = strbuf.toString();
String packpath = path +
packname.replace('.", '/") + '/";
new Extern(packname, packpath, relative);
strbuf.setLength(0);
}
} else {
strbuf.append(ch);
}
}
} finally {
input.close();
}
|
public java.lang.String | toString()String representation of "this" with packagename and the path.
return packageName + (relative? " -> " : " => ") + path;
|
public static boolean | url(java.lang.String url, java.lang.String pkglisturl, com.sun.javadoc.DocErrorReporter reporter)Build the extern package list from given URL or the directory path.
Flag error if the "-link" or "-linkoffline" option is already used.
String errMsg = composeExternPackageList(url, pkglisturl);
if (errMsg != null) {
reporter.printError(errMsg);
return false;
} else {
return true;
}
|