标签:html4 else throws escape except oid lang exce ref
EscapeHtmlReference的escape方法调用以下方法实现: org.apache.commons.lang.Entities.HTML40.escape(writer, string);
代码如下:
public void escape(Writer writer, String str) throws IOException {
int len = str.length();
for(int i = 0; i < len; ++i) {
char c = str.charAt(i);
String entityName = this.entityName(c);
if(entityName == null) {
if(c > 127) {
writer.write("&#");
writer.write(Integer.toString(c, 10));
writer.write(59); //就是个分号
} else {
writer.write(c);
}
} else {
writer.write(38);
writer.write(entityName);
writer.write(59);
}
}
}
标签:html4 else throws escape except oid lang exce ref
原文地址:http://www.cnblogs.com/SEC-fsq/p/7249579.html