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:
- Keywords:
- file format, SMILES
- Created on:
- 2004-12-16
-
Nested Class Summary
Nested classes/interfaces inherited from interface IChemObjectReader
IChemObjectReader.Mode -
Field Summary
FieldsFields inherited from class DefaultIteratingChemObjectReader
errorHandler, modeModifier and TypeFieldDescriptionprotected IChemObjectReaderErrorHandlerprotected IChemObjectReader.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 TypeMethodDescriptionvoidclose()Close the reader.Get the format for this reader.booleanhasNext()Checks whether there is another molecule to read.next()Get the next molecule from the stream.voidremove()File IO generally does not support removing of entries.voidsetReader(InputStream reader) Sets the InputStream from which this ChemObjectReader should read the contents.voidSets the Reader from which this ChemObjectReader should read the contents.Methods inherited from class DefaultIteratingChemObjectReader
accepts, handleError, handleError, handleError, handleError, setErrorHandler, setReaderModeModifier and TypeMethodDescriptionbooleanaccepts(Class<? extends IChemObject> objectClass) Returns whether the givenIChemObjectcan be read or written.voidhandleError(String message) Redirects an error message to theIChemObjectReaderErrorHandler.voidhandleError(String message, int row, int colStart, int colEnd) Redirects an error message to theIChemObjectReaderErrorHandler.voidhandleError(String message, int row, int colStart, int colEnd, Exception exception) Redirects an error message to theIChemObjectReaderErrorHandler.voidhandleError(String message, Exception exception) Redirects an error message to theIChemObjectReaderErrorHandler.voidSets an error handler that is sent events when file format issues occur.voidSets the reader mode.Methods inherited from class ChemObjectIO
addChemObjectIOListener, addSetting, addSettings, fireIOSettingQuestion, getIOSettings, getListeners, getSetting, getSetting, getSettings, hasSetting, removeChemObjectIOListenerModifier and TypeMethodDescriptionvoidaddChemObjectIOListener(IChemObjectIOListener listener) Adds aIChemObjectIOListenerto this IChemObjectIO.<S extends IOSetting>
SaddSetting(IOSetting setting) Add an IOSetting to the reader/writer.voidaddSettings(Collection<IOSetting> settings) Adds a collection ofIOSettings to the reader/writer.protected voidfireIOSettingQuestion(IOSetting setting) FiresIChemObjectIOListener.processIOSettingQuestion(org.openscience.cdk.io.setting.IOSetting)for all managed listeners.Returns an array ofIOSettings defined by this IChemObjectIO class.Access all the listeners for this ChemObject Reader or Writer.<S extends IOSetting>
SgetSetting(String name) Access a named setting managed by this reader/writer.<S extends IOSetting>
SgetSetting(String name, Class<S> c) Access a named setting managed by this reader/writer.Access a collection ofIOSettings for this reader/writer.booleanhasSetting(String name) Determine whether this reader/writer has a setting of the provided name.voidRemoves aIChemObjectIOListenerfrom this IChemObjectIO.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterator
forEachRemaining
-
Field Details
-
BAD_SMILES_INPUT
-
-
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
-
close
Close the reader.- Throws:
IOException- if there is an error during closing
-
remove
public void remove()Description copied from class:DefaultIteratingChemObjectReaderFile IO generally does not support removing of entries.- Specified by:
removein interfaceIterator<IAtomContainer>- Overrides:
removein classDefaultIteratingChemObjectReader<IAtomContainer>
-
setReader
Description copied from interface:IChemObjectReaderSets the Reader from which this ChemObjectReader should read the contents. -
setReader
Description copied from interface:IChemObjectReaderSets the InputStream from which this ChemObjectReader should read the contents.
-