[jdom-interest] Always been there?

Kesav Kumar kesavk at voquette.com
Thu Apr 5 09:26:59 PDT 2001


May be we need both auto flush and non flush.  Its best to provide both
functionality with overloaded methods.  I was trying to write servlet
filters where I wanted to use BufferedOutputstream to improve I/O but the
underlying all the output statements doesn't flush so I switched back to
DataOutputStream.  Its good to have both auto flush and no flush.

Kesav Kumar
Software Engineer
Voquette, Inc.
650 356 3740
mailto:kesavk at voquette.com
http://www.voquette.com
Voquette...Delivering Sound Information


-----Original Message-----
From: Brett McLaughlin [mailto:brett at newInstance.com]
Sent: Wednesday, April 04, 2001 10:14 PM
To: jdom-interest at jdom.org
Subject: [jdom-interest] Always been there?


Anyone know if I'm loony, or has this (what appears to me as a bug) always
been there:

This code outputs a file of 0 bytes:

        Element root = new Element("properties");
        Document doc = new Document(root);

        // Output document to supplied filename
        XMLOutputter outputter = new XMLOutputter("  ", true);
        outputter.output(doc, writer);
        writer.flush();

This code works fine:

        Element root = new Element("properties");
        Document doc = new Document(root);

        // Output document to supplied filename
        XMLOutputter outputter = new XMLOutputter("  ", true);
        outputter.output(doc, writer);
        writer.flush();

Since when has it been the programmer's job to do a flush() on their own?
Seems sort of weird... In this case, the Writer wraps an OutputStreamWriter,
but that shouldn't matter, right?

-Brett

_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com



More information about the jdom-interest mailing list