/**
* Save a single emitter to the XML file
*
* @param out
* The location to which we should save
* @param emitter
* The emitter to store to the XML file
* @throws IOException
* Indicates a failure to write or encode the XML
*/
public static void saveEmitter(OutputStream out, ConfigurableEmitter emitter)
throws IOException {
try {
DocumentBuilder builder = DocumentBuilderFactory.newInstance()
.newDocumentBuilder();
Document document = builder.newDocument();
document.appendChild(emitterToElement(document, emitter));
Result result = new StreamResult(new OutputStreamWriter(out,
"utf-8"));
DOMSource source = new DOMSource(document);
TransformerFactory factory = TransformerFactory.newInstance();
Transformer xformer = factory.newTransformer();
xformer.setOutputProperty(OutputKeys.INDENT, "yes");
xformer.transform(source, result);
} catch (Exception e) {
Log.error(e);
throw new IOException("Failed to save emitter");
}
}
ParticleIO.java 文件源码
java
阅读 18
收藏 0
点赞 0
评论 0
项目:trashjam2017
作者:
评论列表
文章目录