Package org.openscience.cdk.io
Class DefaultChemObjectReader
- java.lang.Object
-
- org.openscience.cdk.io.ChemObjectIO
-
- org.openscience.cdk.io.DefaultChemObjectReader
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,IChemObjectIO
,IChemObjectReader
,ISimpleChemObjectReader
- Direct Known Subclasses:
CDKOWLReader
,CIFReader
,CMLReader
,CrystClustReader
,CTXReader
,GamessReader
,Gaussian03Reader
,Gaussian98Reader
,GhemicalMMReader
,HINReader
,INChIPlainTextReader
,INChIReader
,MDLReader
,MDLRXNReader
,MDLRXNV2000Reader
,MDLRXNV3000Reader
,MDLV2000Reader
,MDLV3000Reader
,Mol2Reader
,Mopac7Reader
,MoSSOutputReader
,PCCompoundASNReader
,PCCompoundXMLReader
,PCSubstanceXMLReader
,PDBReader
,PMPReader
,RGroupQueryReader
,ShelXReader
,SMILESReader
,VASPReader
,XYZReader
,ZMatrixReader
public abstract class DefaultChemObjectReader extends ChemObjectIO implements ISimpleChemObjectReader
Abstract class that ChemObjectReader'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
Fields Modifier and Type Field Description protected IChemObjectReaderErrorHandler
errorHandler
protected IChemObjectReader.Mode
mode
-
Constructor Summary
Constructors Constructor Description DefaultChemObjectReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
fireFrameRead()
Sends a frame read event to the registered ReaderListeners.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
setErrorHandler(IChemObjectReaderErrorHandler handler)
Sets an error handler that is sent events when file format issues occur.void
setReaderMode(IChemObjectReader.Mode mode)
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
accepts, 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 org.openscience.cdk.io.ISimpleChemObjectReader
read
-
-
-
-
Field Detail
-
mode
protected IChemObjectReader.Mode mode
-
errorHandler
protected IChemObjectReaderErrorHandler errorHandler
-
-
Method Detail
-
fireFrameRead
protected void fireFrameRead()
Sends a frame read event to the registered ReaderListeners.
-
setReaderMode
public void setReaderMode(IChemObjectReader.Mode mode)
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
public void setErrorHandler(IChemObjectReaderErrorHandler handler)
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
public void handleError(String message) throws CDKException
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
public void handleError(String message, 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.exception
- the correspondingException
.- Throws:
CDKException
-
handleError
public void handleError(String message, int row, int colStart, int colEnd) 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.- 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
-
-