Package chemaxon.marvin.io.formats
Class MoleculeImporter
- java.lang.Object
-
- chemaxon.marvin.io.formats.MoleculeImporter
-
- All Implemented Interfaces:
chemaxon.marvin.io.formats.MoleculeImporterIface
@PublicAPI public class MoleculeImporter extends Object implements chemaxon.marvin.io.formats.MoleculeImporterIface
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
Fields Modifier and Type Field Description protected chemaxon.marvin.io.formats.MoleculeImporterIface
importer
The wrapped importer.
-
Constructor Summary
Constructors Constructor Description MoleculeImporter(File f)
Constructs 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Iterator<Molecule>
getIterator()
Returns an iterator that iterates through all molecules in the file/stream.Molecule
read()
-
-
-
Constructor Detail
-
MoleculeImporter
public MoleculeImporter(String fileName) throws IOException
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
public MoleculeImporter(String fileName, String opts) throws IOException
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
public MoleculeImporter(File f) throws IOException
Constructs a new importer for the file.- Parameters:
f
- the file to import.- Throws:
IOException
- if an I/O error occurs.
-
MoleculeImporter
public MoleculeImporter(File f, String opts) throws IOException
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
public MoleculeImporter(InputStream inputStream) throws IOException
Constructs a new importer for the input stream.- Parameters:
inputStream
- the stream to import from.- Throws:
IOException
- if an I/O error occurs.
-
MoleculeImporter
public MoleculeImporter(InputStream inputStream, String opts) throws IOException
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
public MoleculeImporter(InputStream inputStream, String opts, String enc) throws IOException
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 Detail
-
read
public Molecule read() throws IOException
- Specified by:
read
in interfacechemaxon.marvin.io.formats.MoleculeImporterIface
- Throws:
IOException
-
getIterator
public Iterator<Molecule> getIterator()
Returns an iterator that iterates through all molecules in the file/stream.- Returns:
- the iterator.
-
close
public void close() throws IOException
- Specified by:
close
in interfacechemaxon.marvin.io.formats.MoleculeImporterIface
- Throws:
IOException
-
-