以下代码给了我这个错误:
java.lang.NullPointerException java.io.FileOutputStream.(来源不明) java.io.FileOutputStream.(来源不明) java.io.FileWriter.(来源不明)
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 类有什么优势?
问题是文件路径错误,如建议的那样。