Package chemaxon.marvin.io.formats
Class MoleculeImporter
java.lang.Object
chemaxon.marvin.io.formats.MoleculeImporter
- All Implemented Interfaces:
MoleculeImporterIface
,AutoCloseable
@PublicApi
public class MoleculeImporter
extends Object
implements MoleculeImporterIface, AutoCloseable
Molecule importer.
Wrapper for MolImporter. Can only read the stream forward
(not seekable stream). In some cases (mrv, cml) it can be faster than
MolImporter.
The input file format is guessed automatically or specified as an import option to the constructor. Many different formats are supported like "mol", "rgf", "sdf", "rdf", "csmol", "csrgf", "cssdf", "csrdf", "mol2", "cml", "mrv", "smiles", "cxsmiles", "pdb", "xyz", "cube", "name". For more information on formats, please visit File Formats in Marvin.
- Since:
- Marvin 5.7
-
Field Summary
-
Constructor Summary
ConstructorDescriptionConstructs a new importer for the file.MoleculeImporter
(File f, String opts) Constructs a new importer for the file.MoleculeImporter
(InputStream inputStream) Constructs a new importer for the input stream.MoleculeImporter
(InputStream inputStream, String opts) Constructs a new importer for the stream.MoleculeImporter
(InputStream inputStream, String opts, String enc) Constructs a new importer for the stream.MoleculeImporter
(String fileName) Constructs a new importer for the file.MoleculeImporter
(String fileName, String opts) Constructs a new importer for the file. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface chemaxon.marvin.io.formats.MoleculeImporterIface
getMDocumentStream, getMolStream
-
Field Details
-
importer
The wrapped importer. Created in the constructor, the interface methods delegates the functionality to this importer.
-
-
Constructor Details
-
MoleculeImporter
Constructs a new importer for the file.- Parameters:
fileName
- the name of the file to import.- Throws:
IOException
- if an I/O error occurs.
-
MoleculeImporter
Constructs a new importer for the file.- Parameters:
fileName
- the name of the file to import.opts
- the file format and options separated by a colon. Autorecognition is called if null or format is not specified.- Throws:
IOException
- if an I/O error occurs.
-
MoleculeImporter
Constructs a new importer for the file.- Parameters:
f
- the file to import.- Throws:
IOException
- if an I/O error occurs.
-
MoleculeImporter
Constructs a new importer for the file.- Parameters:
f
- the file to import.opts
- the file format and options separated by a colon. Autorecognition is called if null or format is not specified.- Throws:
IOException
- if an I/O error occurs.
-
MoleculeImporter
Constructs a new importer for the input stream.- Parameters:
inputStream
- the stream to import from.- Throws:
IOException
- if an I/O error occurs.
-
MoleculeImporter
Constructs a new importer for the stream.- Parameters:
inputStream
- the stream to import from.opts
- the file format and options separated by a colon. Autorecognition is called if null or format is not specified.- Throws:
IOException
- if an I/O error occurs.
-
MoleculeImporter
Constructs a new importer for the stream.- Parameters:
inputStream
- the stream to import from.opts
- the file format and options separated by a colon. Autorecognition is called if null or format is not specified.enc
- the encoding of the stream. Autorecognition may be called if null.- Throws:
IOException
- if an I/O error occurs.
-
-
Method Details
-
read
Description copied from interface:MoleculeImporterIface
Read the next molecule from the stream/file.- Specified by:
read
in interfaceMoleculeImporterIface
- Returns:
- the next molecule, or
null
if no more molecules can be imported. - Throws:
IOException
- If an error occurred during reading.
-
getIterator
Returns an iterator that iterates through all molecules in the file/stream.- Returns:
- the iterator.
-
close
Description copied from interface:MoleculeImporterIface
Close the underlying input stream. IMPORTANT: call this after reading molecules to close concurrent processing properly.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceMoleculeImporterIface
- Throws:
IOException
- If an error has occurred.
-