Sam Adams avatar Sam Adams committed d97c9ea

Updates for CLI tools

Comments (0)

Files changed (2)

compchem-importer/src/main/java/net/chempound/compchem/GaussianLogImporter.java

 import net.chempound.rdf.chempound.ChempoundAggregation;
 import net.chempound.storage.DepositResource;
 import net.chempound.storage.InMemoryResource;
+import net.chempound.storage.LocalFileResource;
 import net.chempound.storage.LocalResource;
 import nu.xom.Document;
 import nu.xom.Element;
 import org.xmlcml.cml.element.CMLMolecule;
 
 import javax.inject.Inject;
-import java.io.*;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
 import java.util.List;
 
 import static org.xmlcml.cml.base.CMLConstants.CML_XPATH;
         inputFile = new InMemoryResource(path, ChemicalMime.CHEMICAL_GAUSSIAN_INPUT, in);
     }
 
-    public void setInputFile(final File file, final String path) throws IOException {
-        final BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
-        try {
-            setInputFile(in, path);
-        } finally {
-            IOUtils.closeQuietly(in);
-        }
+    public void setInputFile(final File file, final String path) {
+        inputFile = new LocalFileResource(path, file);
     }
 
 
         logFile = new InMemoryResource(path, ChemicalMime.CHEMICAL_GAUSSIAN_LOG, in);
     }
 
-    public void setLogFile(final File file, final String path) throws IOException {
-        final BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
-        try {
-            setLogFile(in, path);
-        } finally {
-            IOUtils.closeQuietly(in);
-        }
+    public void setLogFile(final File file, final String path) {
+        logFile = new LocalFileResource(path, file, ChemicalMime.CHEMICAL_GAUSSIAN_LOG);
     }
 
     @Override

compchem-importer/src/main/java/net/chempound/compchem/NWChemLogImporter.java

 import net.chempound.rdf.chempound.ChempoundAggregation;
 import net.chempound.storage.DepositResource;
 import net.chempound.storage.InMemoryResource;
+import net.chempound.storage.LocalFileResource;
 import net.chempound.storage.LocalResource;
 import nu.xom.Document;
 import nu.xom.Element;
         logFile = new InMemoryResource(path, ChemicalMime.CHEMICAL_NWCHEM, in);
     }
 
-    public void setLogFile(final File file, final String path) throws IOException {
-        final BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
-        try {
-            setLogFile(in, path);
-        } finally {
-            IOUtils.closeQuietly(in);
-        }
+    public void setLogFile(final File file, final String path) {
+        logFile = new LocalFileResource(path, file, ChemicalMime.CHEMICAL_NWCHEM);
     }
 
-
     @Override
     protected Document generateCml() throws IOException, ParsingException {
         final Element cml = convertLogToCml(logFile);
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.