Files a bug and provided a patch for master here:

CMLWriter won't close the underlying stream if a writer was provided.This is because CMLWriter maintains an OutputStream and a Writer. The attached patch removes the Writer and adds conversion from Writer -> OutputStream. This isn't always desirable due to encodings so a warning message was added. A null check was also added to 'close()' method.The CMLReader (which uses just an InputStream) throws an IllegalArgumentException if you try to use a Reader - this could also be done for CMLWriter but I think adding the conversion is more user friendly.
I'm not 100% on converting a Writer to an OutputStream but I think in this instance it is okay as Jumbo handles the encodings - still needs a second pair of eyes.


On 16 Oct 2012, at 09:33, John May <> wrote:

cmlwriter.close(); "should" also close the underlying stream of output.close().
However the CML writer is a bit strange an maintains both Writer and OutputStream and only the OutputStream gets closed - this is a bug.

You should normally use Reader/Writer for text but the following works:

OutputStream output = new FileOutputStream("molecule.cml");
CMLWriter cmlwriter = new CMLWriter(output);


On 16 Oct 2012, at 03:13, Francois Berenger <> wrote:

In the javadoc of

Output to a file called "molecule.cml" can done with:

  FileWriter output = new FileWriter("molecule.cml");
  CMLWriter cmlwriter = new CMLWriter(output);

you need to add
as the last line so that the file is really written out to disk.


Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
Cdk-devel mailing list