Class SDFWriter

  • All Implemented Interfaces:
    Closeable, AutoCloseable, IChemObjectIO, IChemObjectWriter

    public class SDFWriter
    extends DefaultChemObjectWriter
    Writes MDL SD files ([Dalby, A. et. al.. Journal of Chemical Information and Computer Sciences. 1992. 32]). A MDL SD file contains one or more molecules, complemented by properties.
    Source code:
    IO options:
    WriteAromaticBondTypesShould aromatic bonds be written as bond type 4?false
    WriteMajorIsotopesWrite atomic mass of any non-null atomic mass including major isotopes (e.g. [12]C)true
    writePropertiesShould molecule properties be written as non-structural datatrue
    WriteQueryFormatValenciesShould valencies be written in the MDL Query format? (deprecated)false
    TruncateLongDataTruncate long data files >200 charactersfalse
    ProgramNameProgram name to write at the top of the molfile header, should be exactly 8 characters longCDK
    ForceWriteAs2DCoordinatesShould coordinates always be written as 2D?false
    WriteDefaultPropertiesWrite trailing zero's on atom/bond property blocks even if they're not used.true
    writeV3000Write all records as V3000false
    Belongs to CDK module:
    file format, MDL SD file
    • Constructor Detail

      • SDFWriter

        public SDFWriter​(BufferedWriter wtr)
        Create an SDfile writer that will output directly to the provided buffered writer.
        wtr - writer
      • SDFWriter

        public SDFWriter​(Writer wtr)
        Create an SDfile writer, the provided writer is buffered if it's not an instance of BufferedWriter. For flush control etc please create with BufferedWriter.
        wtr - writer
      • SDFWriter

        public SDFWriter​(OutputStream output)
        Create an SDfile writer, the provided output stream is wrapped in a UTF-8 buffered writer.
        output - out stream
      • SDFWriter

        public SDFWriter()
      • SDFWriter

        public SDFWriter​(Writer out,
                         Set<String> propertiesToWrite)
        Constructs a new SDFWriter that writes to the given Writer.
        out - The Writer to write to
      • SDFWriter

        public SDFWriter​(Set<String> propertiesToWrite)
        Writes SD-File to a String including the given properties