Commits

Sam Adams committed 595b4d5

Added write document to file method

  • Participants
  • Parent commits ecbb9e4

Comments (0)

Files changed (1)

chemistry-importer/src/main/java/uk/ac/cam/ch/wwmm/chempound/chemistry/CmlImporter.java

     }
 
 
-    protected static void write(Element element, File tempFile) throws IOException {
+    protected static void write(Element element, File file) throws IOException {
         Element copy = (Element) element.copy();
-        BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(tempFile));
+        write(new Document(copy), file);
+    }
+
+    protected static void write(Document doc, File file) throws IOException {
+        BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file));
         try {
             Serializer ser = new Serializer(out);
-            ser.write(new Document(copy));
+            ser.write(doc);
         } finally {
             IOUtils.closeQuietly(out);
         }
-
     }
 
     protected static void write(LocalResource resource, File file) throws IOException {