墊高凳
thread/runnable/executor set priority?
endeavour
ConcurrentModificationException
two connection thread safety
https://developers.google.com/web-toolkit/tools/gwtdesigner/
http://www.cs.ait.ac.th/~on/O/oreilly/java-ent/servlet/ch05_04.htm
http://onjava.com/pub/a/onjava/excerpt/jebp_3/index2.html
http://stackoverflow.com/questions/2872613/caching-images-served-by-servlet
http://pivot.apache.org/
Is it possible to change the natural order of columns in Postgres?
Netbean color
*/
package tolfinclass;
import com.daval.tolfin.client.format.parser.Phrase;
import com.tolfin.base.utils.CacheUtil;
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.logging.Logger;
import javax.swing.text.MutableAttributeSet;
import javax.swing.text.html.HTML.Tag;
import javax.swing.text.html.HTMLEditorKit;
import javax.swing.text.html.parser.ParserDelegator;
/**
* @deprecated HTMLEditorKit is not accurate
*/
public class HTMLConverter {
private boolean hasBrBug = false;
private ArrayList
private ArrayList
private static final Logger logger = CacheUtil.getLogger();
private static final ArrayList
static {
lineBreakTags.add(Tag.DIV);
lineBreakTags.add(Tag.H1);
lineBreakTags.add(Tag.H2);
lineBreakTags.add(Tag.H3);
lineBreakTags.add(Tag.H4);
lineBreakTags.add(Tag.H5);
lineBreakTags.add(Tag.H6);
lineBreakTags.add(Tag.LI);
lineBreakTags.add(Tag.P);
lineBreakTags.add(Tag.PRE);
lineBreakTags.add(Tag.TR);
}
public ArrayList
return convertToStrings(html, new HTMLEditorKit.ParserCallback() {
private final StringBuilder line = new StringBuilder();
@Override
public void handleText(char[] data, int pos) {
String str = new String(data);
if (hasBrBug) {
str = str.replaceFirst("^>", "");
hasBrBug = false;
}
line.append(str);
}
@Override
public void handleEndOfLineString(String eol) {
lines.add(line.toString());
}
@Override
public void handleSimpleTag(Tag t, MutableAttributeSet a, int pos) {
if (Tag.BR == t) {
hasBrBug = true;
addLine();
}
}
@Override
public void handleStartTag(Tag t, MutableAttributeSet a, int pos) {
checkTag(t);
}
@Override
public void handleEndTag(Tag t, int pos) {
checkTag(t);
}
private void checkTag(Tag currentTag) {
for (Tag breakTag : lineBreakTags) { // Line break tags
if (breakTag == currentTag) {
addLine();
}
}
}
private void addLine() {
lines.add(line.toString());
line.delete(0, line.length());
}
});
}
private ArrayList
lines.clear();
parseHTML(html, parserCallback);
final ArrayList
for (final String line : lines) {
if (!line.trim().equals("")) { // check blank line
result.add(line);
}
}
return result;
}
private void parseHTML(String html, HTMLEditorKit.ParserCallback parserCallback) {
try {
new ParserDelegator().parse(new StringReader(WebParserUtils.unescapeHtml(html)), parserCallback, true);
} catch (IOException ex) {
logger.warning(ex.toString());
}
}
}
沒有留言:
發佈留言