[jdom-interest] Always been there?

Jeff Turner jeff at socialchange.net.au
Thu Apr 5 05:14:30 PDT 2001


On Wed, Apr 04, 2001 at 11:11:33PM -0700, Joseph Bowbeer wrote:
> Generally, it's the programmer's job to call flush().

I'm with you here. Often, eg in servlets, I don't want to flush until the very
end.

> Though the Print*
> classes have options for flushing automatically

Well JDOM wouldn't trigger the auto-flush, because it doesn't use the println()
methods, but that suggests one compromise; add a flag to outputter.output()
that determines whether it flushes.

--Jeff

>  It's also the programmer's
> job to call writer.close() and that's supposed to flush() first.
> 
> 
> ----- original message -----
> From: Brett McLaughlin
> Date: Thu, 5 Apr 2001 00:14:22 -0500
> 
> 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@yourhost.com



More information about the jdom-interest mailing list