public class IteratingSDFReader extends DefaultIteratingChemObjectReader<IAtomContainer>
MDLV2000Reader
or
MDLV3000Reader
reader; it does not work
for SDF files with MDL formats prior to the V2000 format.
Example use:
File sdfFile = new File("../zinc-structures/ZINC_subset3_3D_charged_wH_maxmin1000.sdf"); IteratingSDFReader reader = new IteratingSDFReader( new FileInputStream(sdfFile), DefaultChemObjectBuilder.getInstance() ); while (reader.hasNext()) { IAtomContainer molecule = (IAtomContainer)reader.next(); }
MDLV2000Reader
,
MDLV3000Reader
IChemObjectReader.Mode
errorHandler, mode
Constructor and Description |
---|
IteratingSDFReader(InputStream in,
IChemObjectBuilder builder)
Constructs a new IteratingMDLReader that can read Molecule from a given InputStream.
|
IteratingSDFReader(InputStream in,
IChemObjectBuilder builder,
boolean skip)
Constructs a new IteratingMDLReader that can read Molecule from a given a
InputStream.
|
IteratingSDFReader(Reader in,
IChemObjectBuilder builder)
Constructs a new IteratingMDLReader that can read Molecule from a given Reader.
|
IteratingSDFReader(Reader in,
IChemObjectBuilder builder,
boolean skip)
Constructs a new IteratingMDLReader that can read Molecule from a given a
Reader.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this IChemObjectIO's resources.
|
void |
customizeJob() |
IResourceFormat |
getFormat()
Returns the
IResourceFormat class for this IO class. |
boolean |
hasNext()
Returns true if another
IAtomContainer can be read. |
IAtomContainer |
next()
Returns the next
IAtomContainer . |
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 |
setReader(Reader reader)
Sets the Reader from which this ChemObjectReader should read
the contents.
|
void |
setSkip(boolean skip)
Indicate whether the reader should skip over SDF records
that cause problems.
|
accepts, handleError, handleError, handleError, handleError, setErrorHandler, setReaderMode
addChemObjectIOListener, addSetting, addSettings, fireIOSettingQuestion, getIOSettings, getListeners, getSetting, getSetting, getSettings, hasSetting, removeChemObjectIOListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addChemObjectIOListener, addSetting, addSettings, getIOSettings, getListeners, getSetting, getSetting, getSettings, hasSetting, removeChemObjectIOListener
forEachRemaining
public IteratingSDFReader(Reader in, IChemObjectBuilder builder)
in
- The Reader to read frombuilder
- The builderpublic IteratingSDFReader(InputStream in, IChemObjectBuilder builder)
in
- The InputStream to read frombuilder
- The builderpublic IteratingSDFReader(InputStream in, IChemObjectBuilder builder, boolean skip)
in
- the InputStream
to read frombuilder
- builder to useskip
- whether to skip null moleculespublic IteratingSDFReader(Reader in, IChemObjectBuilder builder, boolean skip)
in
- the Reader
to read frombuilder
- builder to useskip
- whether to skip null moleculespublic IResourceFormat getFormat()
IChemObjectIO
IResourceFormat
class for this IO class.public boolean hasNext()
IAtomContainer
can be read.public void setSkip(boolean skip)
skip
- ignore error molecules continue readingpublic IAtomContainer next()
IAtomContainer
.public void close() throws IOException
IChemObjectIO
IOException
- when the wrapper IO class cannot be closed.public void remove()
DefaultIteratingChemObjectReader
remove
in interface Iterator<IAtomContainer>
remove
in class DefaultIteratingChemObjectReader<IAtomContainer>
public void setReader(Reader reader)
IChemObjectReader
public void setReader(InputStream reader)
IChemObjectReader
public void customizeJob()
Copyright © 2021. All rights reserved.