/**
*******************************************************************************
- * Copyright (C) 2005-2010, International Business Machines Corporation and *
+ * Copyright (C) 2005-2013, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
* APIInfo. Throws IOException if EOF is encountered before the
* token is complete (i.e. before the separator character is
* encountered) or if the token exceeds the maximum length of
- * 255 chars.
+ * 511 chars.
*/
public static String readToken(BufferedReader r) throws IOException {
- char[] buf = new char[256];
+ char[] buf = new char[512];
int i = 0;
for (; i < buf.length; ++i) {
int c = r.read();
}
public void print(PrintWriter pw, boolean detail, boolean html, boolean withStatus) {
- StringBuffer buf = new StringBuffer();
+ StringBuilder buf = new StringBuilder();
+ format(buf, detail, html, withStatus);
+ pw.print(buf.toString());
+ }
+ public void format(StringBuilder buf, boolean detail, boolean html, boolean withStatus) {
// remove all occurrences of icu packages from the param string
// fortunately, all the packages have 4 chars (lang, math, text, util).
String xsig = sig;
for (int i = (withStatus ? STA : VIS) ; i < CAT; ++i) { // include status
String s = get(i, false);
if (s != null && s.length() > 0) {
- if (html && s.indexOf("internal") != -1) {
- buf.append("<span style='color:red'>");
- buf.append(s);
- buf.append("</span>");
- } else {
- buf.append(s);
- buf.append(' ');
+ if (html) {
+ s = s.trim();
+ if (i == STA) {
+ String color = null;
+ if (s.startsWith("(internal)")) {
+ color = "red";
+ } else if (s.startsWith("(draft)")) {
+ color = "orange";
+ } else if (s.startsWith("(stable)")) {
+ color = "green";
+ } else if (s.startsWith("(deprecated)")) {
+ color = "gray";
+ }
+ if (color != null) {
+ s = "<span style='color:" + color + "'>" + s + "</span>";
+ }
+ }
}
+ buf.append(s);
+ buf.append(' ');
}
}
buf.append(xsig.substring(n));
break;
}
-
- pw.print(buf.toString());
}
public void println(PrintWriter pw, boolean detail, boolean html) {