org.openscience.cdk.io
Class SDFWriter

java.lang.Object
  extended by org.openscience.cdk.io.ChemObjectIO
      extended by org.openscience.cdk.io.DefaultChemObjectWriter
          extended by org.openscience.cdk.io.SDFWriter
All Implemented Interfaces:
Closeable, IChemObjectIO, IChemObjectWriter

@TestClass(value="org.openscience.cdk.io.SDFWriterTest")
public class SDFWriter
extends DefaultChemObjectWriter

Writes MDL SD files ([Dalby, A. and Nourse, J. G. and Hounshell, W. D. and Gushurst, A. K. and Grier, D. L. and Leland, B. A. and Laufer, J., Description of Several Chemical Structure File Formats Used by Computer Programs Developed at Molecular Design Limited, Journal of Chemical Information and Computer Sciences, 1992, 32:244-255]). A MDL SD file contains one or more molecules, complemented by properties.

Keywords:
file format, MDL SD file
Belongs to CDK module:
io
Source code:
cdk-1.4.x

Constructor Summary
SDFWriter()
           
SDFWriter(OutputStream output)
          Constructs a new MDLWriter that can write to a given OutputStream.
SDFWriter(Writer out)
          Constructs a new SDFWriter that writes to the given Writer.
 
Method Summary
 boolean accepts(Class classObject)
          Returns whether the given IChemObject can be read or written.
 void close()
          Flushes the output and closes this object.
 void customizeJob()
           
 IResourceFormat getFormat()
          Returns the IResourceFormat class for this IO class.
 void setWriter(OutputStream output)
          Sets the OutputStream from which this ChemObjectWriter should write the contents.
 void setWriter(Writer out)
          Sets the Writer from which this ChemObjectWriter should write the contents.
 void write(IChemObject object)
          Writes a IChemObject to the MDL SD file formated output.
 
Methods inherited from class org.openscience.cdk.io.ChemObjectIO
addChemObjectIOListener, addSetting, addSettings, getIOSettings, getListeners, getSetting, getSetting, getSettings, hasSetting, removeChemObjectIOListener
 
Methods inherited from class java.lang.Object
equals, 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

SDFWriter

public SDFWriter(Writer out)
Constructs a new SDFWriter that writes to the given Writer.

Parameters:
out - The Writer to write to

SDFWriter

public SDFWriter(OutputStream output)
Constructs a new MDLWriter that can write to a given OutputStream.

Parameters:
output - The OutputStream to write to

SDFWriter

public SDFWriter()
Method Detail

getFormat

@TestMethod(value="testGetFormat")
public IResourceFormat getFormat()
Description copied from interface: IChemObjectIO
Returns the IResourceFormat class for this IO class.


setWriter

public void setWriter(Writer out)
               throws CDKException
Description copied from interface: IChemObjectWriter
Sets the Writer from which this ChemObjectWriter should write the contents.

Throws:
CDKException

setWriter

public void setWriter(OutputStream output)
               throws CDKException
Description copied from interface: IChemObjectWriter
Sets the OutputStream from which this ChemObjectWriter should write the contents.

Throws:
CDKException

close

@TestMethod(value="testClose")
public void close()
           throws IOException
Flushes the output and closes this object.

Throws:
IOException

accepts

@TestMethod(value="testAccepts")
public boolean accepts(Class classObject)
Description copied from interface: IChemObjectIO
Returns whether the given IChemObject can be read or written.

Parameters:
classObject - IChemObject of which is tested if it can be handled.
Returns:
true, if the IChemObject can be handled.

write

public void write(IChemObject object)
           throws CDKException
Writes a IChemObject to the MDL SD file formated output. It can only output IChemObjects of type IChemFile, IAtomContainerSet and IMoleculeSet.

Parameters:
object - an acceptable IChemObject
Throws:
CDKException - is thrown if the output does not support the data in the object
See Also:
accepts(Class)

customizeJob

public void customizeJob()