Package org.openscience.cdk.io.iterator
Class IteratingSMILESReader
java.lang.Object
org.openscience.cdk.io.ChemObjectIO
org.openscience.cdk.io.iterator.DefaultIteratingChemObjectReader<IAtomContainer>
org.openscience.cdk.io.iterator.IteratingSMILESReader
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Iterator<IAtomContainer>
,IChemObjectIO
,IChemObjectReader
,IIteratingChemObjectReader<IAtomContainer>
Iterating SMILES file reader. It allows to iterate over all molecules
in the SMILES file, without being read into memory all. Suitable
for very large SMILES files. These SMILES files are expected to have one
molecule on each line. If a line could not be parsed and empty molecule is
returned and the property
BAD_SMILES_INPUT
is set to the attempted
input. The error is also logged.
For parsing each SMILES it still uses the normal SMILESReader.
- Author:
- Egon Willighagen <egonw@sci.kun.nl>
- See Also:
- Source code:
- main
- Belongs to CDK module:
- smiles
- Keywords:
- file format, SMILES
- Created on:
- 2004-12-16
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.openscience.cdk.io.IChemObjectReader
IChemObjectReader.Mode
-
Field Summary
FieldsFields inherited from class org.openscience.cdk.io.iterator.DefaultIteratingChemObjectReader
errorHandler, mode
-
Constructor Summary
ConstructorsConstructorDescriptionIteratingSMILESReader
(InputStream in, IChemObjectBuilder builder) Constructs a new IteratingSMILESReader that can read Molecule from a given InputStream and IChemObjectBuilder.IteratingSMILESReader
(Reader in, IChemObjectBuilder builder) Constructs a new IteratingSMILESReader that can read Molecule from a given Reader. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the reader.Get the format for this reader.boolean
hasNext()
Checks whether there is another molecule to read.next()
Get the next molecule from the stream.void
remove()
File IO generally does not support removing of entries.void
setReader
(InputStream reader) Sets the InputStream from which this ChemObjectReader should read the contents.void
Sets the Reader from which this ChemObjectReader should read the contents.Methods inherited from class org.openscience.cdk.io.iterator.DefaultIteratingChemObjectReader
accepts, handleError, handleError, handleError, handleError, setErrorHandler, setReaderMode
Methods inherited from class org.openscience.cdk.io.ChemObjectIO
addChemObjectIOListener, addSetting, addSettings, fireIOSettingQuestion, getIOSettings, getListeners, getSetting, getSetting, getSettings, hasSetting, removeChemObjectIOListener
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.openscience.cdk.io.IChemObjectIO
addChemObjectIOListener, addSetting, addSettings, getIOSettings, getListeners, getSetting, getSetting, getSettings, hasSetting, removeChemObjectIOListener
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
BAD_SMILES_INPUT
Store the problem input as a property.- See Also:
-
-
Constructor Details
-
IteratingSMILESReader
Constructs a new IteratingSMILESReader that can read Molecule from a given Reader.- Parameters:
in
- The Reader to read frombuilder
- The builder to use- See Also:
-
IteratingSMILESReader
Constructs a new IteratingSMILESReader that can read Molecule from a given InputStream and IChemObjectBuilder.- Parameters:
in
- The input streambuilder
- The builder
-
-
Method Details
-
getFormat
Get the format for this reader.- Returns:
- An instance of
SMILESFormat
-
hasNext
public boolean hasNext()Checks whether there is another molecule to read.- Returns:
- true if there are molecules to read, false otherwise
-
next
Get the next molecule from the stream.- Returns:
- The next molecule
-
close
Close the reader.- Throws:
IOException
- if there is an error during closing
-
remove
public void remove()Description copied from class:DefaultIteratingChemObjectReader
File IO generally does not support removing of entries.- Specified by:
remove
in interfaceIterator<IAtomContainer>
- Overrides:
remove
in classDefaultIteratingChemObjectReader<IAtomContainer>
-
setReader
Description copied from interface:IChemObjectReader
Sets the Reader from which this ChemObjectReader should read the contents. -
setReader
Description copied from interface:IChemObjectReader
Sets the InputStream from which this ChemObjectReader should read the contents.
-