0

以下代码给了我这个错误:

java.lang.NullPointerException java.io.FileOutputStream.(Unknown Source) java.io.FileOutputStream.(Unknown Source) java.io.FileWriter.(Unknown Source)

SAXBuilder parser = new SAXBuilder();
this.document = parser.build(path);

//changes on the doc happening here

FileWriter writer = new FileWriter(path);
XMLOutputter out = new XMLOutputter();
out.output(this.document, writer);
writer.flush();
writer.close();

怎么来的?文件被锁定还是什么?

旁注:使用 BufferedOutputStream 类有什么好处?

4

1 回答 1

0

问题是文件的路径错误,如建议的那样。

于 2012-04-26T11:03:47.850 回答