#1262 CMLWriter won't close underlying stream

master
closed
nobody
1
2012-11-03
2012-10-16
John May
No

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.

1 Attachments

Discussion

  • +1 one the conversion. Is it always that it uses only this write methods in the end, and none of the others, like write(byte b)?

    I do not see how to test this, so will approve and push it now into master.

     
    • status: open --> closed