Added convenience method for writing a scene to a file using a scene

writer.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@2227 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2003-01-30 19:16:50 +00:00
parent 744421c9ec
commit a11f45dec4
@@ -1,8 +1,11 @@
//
// $Id: SceneWriter.java,v 1.2 2001/12/05 04:45:13 mdb Exp $
// $Id: SceneWriter.java,v 1.3 2003/01/30 19:16:50 mdb Exp $
package com.threerings.whirled.tools.xml;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Iterator;
import org.xml.sax.SAXException;
@@ -67,4 +70,21 @@ public class SceneWriter
writer.dataElement("neighbor", (String)iter.next());
}
}
/**
* Writes the supplied scene out to the specified file using the
* supplied scene writer.
*/
public static void writeScene (File out, SceneWriter writer,
EditableScene scene)
throws IOException, SAXException
{
FileWriter fout = new FileWriter(out);
DataWriter dout = new DataWriter(fout);
dout.setIndentStep(2);
dout.startDocument();
writer.writeScene(scene, dout);
dout.endDocument();
fout.close();
}
}