Package org.openscience.cdk.io.iterator
Class DefaultIteratingChemObjectReader<T extends IChemObject>
java.lang.Object
org.openscience.cdk.io.ChemObjectIO
org.openscience.cdk.io.iterator.DefaultIteratingChemObjectReader<T>
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Iterator<T>
,IChemObjectIO
,IChemObjectReader
,IIteratingChemObjectReader<T>
- Direct Known Subclasses:
IteratingPCCompoundASNReader
,IteratingPCCompoundXMLReader
,IteratingPCSubstancesXMLReader
,IteratingSDFReader
,IteratingSMILESReader
public abstract class DefaultIteratingChemObjectReader<T extends IChemObject>
extends ChemObjectIO
implements IIteratingChemObjectReader<T>
Abstract class that IteratingChemObjectReader's can implement to have it
take care of basic stuff, like managing the ReaderListeners.
- Source code:
- main
- Belongs to CDK module:
- io
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.openscience.cdk.io.IChemObjectReader
IChemObjectReader.Mode
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected IChemObjectReaderErrorHandler
protected IChemObjectReader.Mode
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
accepts
(Class<? extends IChemObject> objectClass) Returns whether the givenIChemObject
can be read or written.void
handleError
(String message) Redirects an error message to theIChemObjectReaderErrorHandler
.void
handleError
(String message, int row, int colStart, int colEnd) Redirects an error message to theIChemObjectReaderErrorHandler
.void
handleError
(String message, int row, int colStart, int colEnd, Exception exception) Redirects an error message to theIChemObjectReaderErrorHandler
.void
handleError
(String message, Exception exception) Redirects an error message to theIChemObjectReaderErrorHandler
.void
remove()
File IO generally does not support removing of entries.void
Sets an error handler that is sent events when file format issues occur.void
Sets the reader mode.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, close, getFormat, getIOSettings, getListeners, getSetting, getSetting, getSettings, hasSetting, removeChemObjectIOListener
Methods inherited from interface org.openscience.cdk.io.IChemObjectReader
setReader, setReader
Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next
-
Field Details
-
mode
-
errorHandler
-
-
Constructor Details
-
DefaultIteratingChemObjectReader
public DefaultIteratingChemObjectReader()
-
-
Method Details
-
accepts
Description copied from interface:IChemObjectIO
Returns whether the givenIChemObject
can be read or written.- Specified by:
accepts
in interfaceIChemObjectIO
- Parameters:
objectClass
-IChemObject
of which is tested if it can be handled.- Returns:
- true, if the
IChemObject
can be handled.
-
remove
public void remove()File IO generally does not support removing of entries.- Specified by:
remove
in interfaceIterator<T extends IChemObject>
-
setReaderMode
Description copied from interface:IChemObjectReader
Sets the reader mode. If Mode.STRICT, then the reader will fail on any problem in the format of the read file, instead of trying to recover from that.- Specified by:
setReaderMode
in interfaceIChemObjectReader
-
setErrorHandler
Sets an error handler that is sent events when file format issues occur.- Specified by:
setErrorHandler
in interfaceIChemObjectReader
- Parameters:
handler
-IChemObjectReaderErrorHandler
to send error messages to.
-
handleError
Redirects an error message to theIChemObjectReaderErrorHandler
. Throws anCDKException
when in STRICTIChemObjectReader.Mode
.- Specified by:
handleError
in interfaceIChemObjectReader
- Parameters:
message
- the error message.- Throws:
CDKException
-
handleError
Redirects an error message to theIChemObjectReaderErrorHandler
. Throws anCDKException
when in STRICTIChemObjectReader.Mode
.- Specified by:
handleError
in interfaceIChemObjectReader
- Parameters:
message
- the error message.exception
- the correspondingException
.- Throws:
CDKException
-
handleError
Redirects an error message to theIChemObjectReaderErrorHandler
. Throws anCDKException
when in STRICTIChemObjectReader.Mode
.- Specified by:
handleError
in interfaceIChemObjectReader
- Parameters:
message
- the error message.row
- Row in the file where the error is found.colStart
- Start column in the file where the error is found.colEnd
- End column in the file where the error is found.- Throws:
CDKException
-
handleError
public void handleError(String message, int row, int colStart, int colEnd, Exception exception) throws CDKException Redirects an error message to theIChemObjectReaderErrorHandler
. Throws anCDKException
when in STRICTIChemObjectReader.Mode
.- Specified by:
handleError
in interfaceIChemObjectReader
- Parameters:
message
- the error message.row
- Row in the file where the error is found.colStart
- Start column in the file where the error is found.colEnd
- End column in the file where the error is found.exception
- the correspondingException
.- Throws:
CDKException
-