Package org.openscience.cdk.io
Class MDLV3000Writer
- java.lang.Object
-
- org.openscience.cdk.io.ChemObjectIO
-
- org.openscience.cdk.io.DefaultChemObjectWriter
-
- org.openscience.cdk.io.MDLV3000Writer
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,IChemObjectIO
,IChemObjectWriter
public final class MDLV3000Writer extends DefaultChemObjectWriter
Ctab V3000 format output. This writer provides output to the more modern (but less widely supported) V3000 format. Unlikely the V2000 format that is limited to 999 atoms or bonds V3000 can write arbitrarily large molecules. Beyond this the format removes some (but not all) ambiguities and simplifies output values with tagging (e.g 'CHG=-1' instead of '5').
Supported Features:- Atom Block, non-query features
- Bond Block, supported are query bond types 4 aromatic, 5 single or double, 6 single or aromatic, 7 double or aromatic, and 8 any as well as the query property that indicates whether a bond is located in a ring or in a chain
- Sgroup Block, partial support for all chemical Sgroups, complete support for: Abbreviations, MultipleGroup, SRUs, (Un)ordered Mixtures
-
-
Constructor Summary
Constructors Constructor Description MDLV3000Writer()
Default empty constructor.MDLV3000Writer(OutputStream out)
Create a new V3000 writer, output to the provided JDK output stream.MDLV3000Writer(Writer writer)
Create a new V3000 writer, output to the provided JDK writer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accepts(Class<? extends IChemObject> c)
Returns whether the givenIChemObject
can be read or written.void
close()
Closes this IChemObjectIO's resources.void
customizeJob()
IResourceFormat
getFormat()
Returns theIResourceFormat
class for this IO class.void
setWriter(OutputStream writer)
Sets the OutputStream from which this ChemObjectWriter should write the contents.void
setWriter(Writer writer)
Sets the Writer from which this ChemObjectWriter should write the contents.void
write(IChemObject object)
Writes a molecule to the V3000 format.-
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
-
-
-
-
Constructor Detail
-
MDLV3000Writer
public MDLV3000Writer(Writer writer)
Create a new V3000 writer, output to the provided JDK writer.- Parameters:
writer
- output location
-
MDLV3000Writer
public MDLV3000Writer(OutputStream out) throws CDKException
Create a new V3000 writer, output to the provided JDK output stream.- Parameters:
out
- output location- Throws:
CDKException
-
MDLV3000Writer
public MDLV3000Writer()
Default empty constructor.
-
-
Method Detail
-
write
public void write(IChemObject object) throws CDKException
Writes a molecule to the V3000 format. Writes the content of "object" to output.- Parameters:
object
- the object of which the content is outputted- Throws:
CDKException
- state exception (e.g undef bonds), unsupported format feature, object not supported etc
-
setWriter
public void setWriter(Writer writer) throws CDKException
Sets the Writer from which this ChemObjectWriter should write the contents.- Throws:
CDKException
-
setWriter
public void setWriter(OutputStream writer) throws CDKException
Sets the OutputStream from which this ChemObjectWriter should write the contents.- Throws:
CDKException
-
getFormat
public IResourceFormat getFormat()
Returns theIResourceFormat
class for this IO class.
-
accepts
public boolean accepts(Class<? extends IChemObject> c)
Returns whether the givenIChemObject
can be read or written.- Parameters:
c
-IChemObject
of which is tested if it can be handled.- Returns:
- true, if the
IChemObject
can be handled.
-
close
public void close() throws IOException
Closes this IChemObjectIO's resources.- Throws:
IOException
- when the wrapper IO class cannot be closed.
-
customizeJob
public void customizeJob()
-
-