[jdom-interest] XMLOutputter naming questions
guru at edamame.stinky.com
Sun Oct 1 11:42:39 PDT 2000
On Sat, Sep 30, 2000 at 10:25:41PM -0700, Joseph Bowbeer wrote:
> Am I correct in thinking that it's better to implement outputString
> using a StringWriter than a ByteArrayOutputStream? Should be more
> efficient, right? And should also make it clear to someone looking at
> the code how to get the StringBuffer more directly.
Interesting point. I've never looked at the source code for
StringWriter but I imagine they did a better job. The reason I started
with a BAOS was just because I hadn't yet written the versions of
output(...) that take a Writer.
It gets complicated when I start thinking about encodings. What if
the XMLOutputter tries to use a fancy character encoding and prints
funny bytes to a byte array, then when you call toString() won't it
interpret them as ASCII/Unicode and screw up? Makes my head hurt.
I wonder what the author of Java IO has to say? :-) (I'm cc'ing the
list and Rusty in case they have something to say about encodings,
hope you don't mind.)
> When you've finished with your XMLOutputter mods, please let me
> know. I want to use it.
I'll post a new diff today.
Alex Chaffee mailto:alex at jguru.com
jGuru - Java News and FAQs http://www.jguru.com/alex/
Creator of Gamelan http://www.gamelan.com/
Founder of Purple Technology http://www.purpletech.com/
Curator of Stinky Art Collective http://www.stinky.com/
More information about the jdom-interest