Sam Adams avatar Sam Adams committed 595b4d5

Added write document to file method

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 {
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.