FreeMind 的 WHODO 修改版
Freemind Hacking Howto
编译 FreeMind
FAQ
build.xml 解析
build
build.xml 异常处理
报错
[javac] Compiling 65 source files to E:\Home\WORK\eclipse\bin\classes
[javac] E:\Home\WORK\eclipse\freemind\generated\actions\freemind\controller\actions\generated\instance\AddArrowLinkXmlAction.java:45: -source 1.3 中不支持注释
[javac] (请尝试使用 -source 1.5 以启用注释)
[javac] @XmlAccessorType(AccessType.FIELD)
[javac] ^
[javac] E:\Home\WORK\eclipse\freemind\generated\actions\freemind\controller\actions\generated\instance\AddArrowLinkXmlAction.java:45: -source 1.3 中不支持注释
[javac] (请尝试使用 -source 1.5 以启用注释)
[javac] @XmlAccessorType(AccessType.FIELD)
[javac] ^
报错
[javac] E:\Home\WORK\eclipse\freemind\freemind\preferences\layout\OptionPanel.java:67: 找不到符号
[javac] 符号: 类 OptionPanelWindowConfigurationStorageType
[javac] 位置: 软件包 freemind.controller.actions.generated.instance
[javac] import freemind.controller.actions.generated.instance.OptionPanelWindowConfigurationStorageType;
[javac] ^
[javac] 符号: 类 OptionPanelWindowConfigurationStorageType
[javac] 位置: 软件包 freemind.controller.actions.generated.instance
[javac] import freemind.controller.actions.generated.instance.OptionPanelWindowConfigurationStorageType;
[javac] ^
classpath 为 :
lib/ant/lib/jaxb-xjc.jar:lib/ant/lib/jaxb-api.jar:lib/ant/lib/jaxb-impl.jar:lib/ant/lib/jaxb-libs.jar:lib/ant/lib/namespace.jar:lib/ant/lib/relaxngDatatype.jar:lib/ant/lib/xsdlib.jar:lib/ant/lib/jax-qname.jar:lib/ant/lib/sax.jar:lib/ant/lib/dom.jar:lib/commons-lang-2.0.jar:lib/forms-1.0.5.jar
lib/ant/lib/jaxb-xjc.jar:lib/ant/lib/jaxb-api.jar:lib/ant/lib/jaxb-impl.jar:lib/ant/lib/jaxb-libs.jar:lib/ant/lib/namespace.jar:lib/ant/lib/relaxngDatatype.jar:lib/ant/lib/xsdlib.jar:lib/ant/lib/jax-qname.jar:lib/ant/lib/sax.jar:lib/ant/lib/dom.jar:lib/commons-lang-2.0.jar:lib/forms-1.0.5.jar
处理流程
Hacking
中文内容的存储。utf-8 格式的 xml 文件。
main/XMLElement.java
protected void writeEncoded(Writer writer, String str)
int unicode = (int) ch;
if ((unicode < 32) /*|| (unicode > 126)*/ ) {
writer.write('&'); writer.write('#');
writer.write('x');
writer.write(Integer.toString(unicode, 16));
writer.write(';');
} else {
writer.write(ch);
}
if ((unicode < 32) /*|| (unicode > 126)*/ ) {
writer.write('&'); writer.write('#');
writer.write('x');
writer.write(Integer.toString(unicode, 16));
writer.write(';');
} else {
writer.write(ch);
}
写入:String newStr = new String(oldStr.getByte(“GB2312”), “ISO8859_1”);
读出:String newStr = new String(oldStr.getByte(“ISO8859_1”),”GB2312”);
读出:String newStr = new String(oldStr.getByte(“ISO8859_1”),”GB2312”);
示例
import java.io.*;
public class inputtest {
public static void main(String[] args) {
String outfile = null;
try { convert(args[0], args[1], "GB2312", "UTF8"); } // or "BIG5"
catch (Exception e) {
System.out.print(e.getMessage());
System.exit(1);
}
}
public static void convert(String infile, String outfile, String from, String to)
throws IOException, UnsupportedEncodingException
{
// set up byte streams
InputStream in;
if (infile != null) in = new FileInputStream(infile);
else in = System.in;
OutputStream out;
if (outfile != null) out = new FileOutputStream(outfile);
else out = System.out;
// Use default encoding if no encoding is specified.
if (from == null) from = System.getProperty("file.encoding");
if (to == null) to = System.getProperty("file.encoding");
// Set up character stream
Reader r = new BufferedReader(new InputStreamReader(in, from));
Writer w = new BufferedWriter(new OutputStreamWriter(out, to));
// Copy characters from input to output. The InputStreamReader
// converts from the input encoding to Unicode,, and the OutputStreamWriter
// converts from Unicode to the output encoding. Characters that cannot be
// represented in the output encoding are output as '?'
char[] buffer = new char[4096];
int len;
while((len = r.read(buffer)) != -1)
w.write(buffer, 0, len);
r.close();
w.flush();
w.close();
}
}
public class inputtest {
public static void main(String[] args) {
String outfile = null;
try { convert(args[0], args[1], "GB2312", "UTF8"); } // or "BIG5"
catch (Exception e) {
System.out.print(e.getMessage());
System.exit(1);
}
}
public static void convert(String infile, String outfile, String from, String to)
throws IOException, UnsupportedEncodingException
{
// set up byte streams
InputStream in;
if (infile != null) in = new FileInputStream(infile);
else in = System.in;
OutputStream out;
if (outfile != null) out = new FileOutputStream(outfile);
else out = System.out;
// Use default encoding if no encoding is specified.
if (from == null) from = System.getProperty("file.encoding");
if (to == null) to = System.getProperty("file.encoding");
// Set up character stream
Reader r = new BufferedReader(new InputStreamReader(in, from));
Writer w = new BufferedWriter(new OutputStreamWriter(out, to));
// Copy characters from input to output. The InputStreamReader
// converts from the input encoding to Unicode,, and the OutputStreamWriter
// converts from Unicode to the output encoding. Characters that cannot be
// represented in the output encoding are output as '?'
char[] buffer = new char[4096];
int len;
while((len = r.read(buffer)) != -1)
w.write(buffer, 0, len);
r.close();
w.flush();
w.close();
}
}