>From: Greg Nudelman <[EMAIL PROTECTED]>
>This is one of a few things I find of extreme annoyance in Java. I do not
>think any other modern programming language makes you remember:
>
>new PrintWriter(new BufferedWriter(new FileWriter("foo.out")));
>
>just to get a file handle!! (This is one area where C syntax may even be
>easier to remember then Java... Scary!)
Well, to be sure, this doesn't give you a filehandle. It gives you an output
stream that goes to a filesystem, buffers it, and then provides utility
functions. With great power comes great responsibility, and all that rot.
Maybe people would remember that if they were all bitten by radioacive
spiders and mutated into genetic freaks who would walk on walls.
>I can never remember the syntax, as I have to write to a file maybe 5-6
>times a year. And just imagine being tested on an interview by some moron
>who just looked it up himself that very morning. ("Greg, how do you
>implement reading the binary file vs. ASCII file in Java?") So, Mr.
>Bright,
>how often do YOU write that code (without docs and Google)?
It's orthogonal: streams are binary, writers aren't. Verrrrry difficult to
remember.
>Hmmm... Maybe I should just write my own utility that I can at least
>remember the syntax for.
>
>I'm thinking something like:
>
>BufferedFileWriter fw = new BufferedFileWriter("foo.out");
>fw.write(stringBuffer.toString());
>
>
>For PrintWriters:
>
>PrintingBufferedFileWriter pfw = new PrintingBufferedFileWriter("foo.out");
>pfw.print(stringBuffer.toString());
>
>To be fair, I guess I have the advantage - I can go back and refactor my
>stuff, and I do not need to be v1.0 backward compatible...
And even fairer, you end up writing classes to do SPECIFICALLY what you
want, and if you actually want to step outside your little lines, you end up
right back where you were, relying on Java's piped input architecture.
*shrug* Six or a half dozen, it doesn't matter.
-----------------------------------------------
Joseph B. Ottinger [EMAIL PROTECTED]
http://enigmastation.com IT Consultant
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx
To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm