Manning's Countdown to 2014
. Use discount code crdotd14 all month for 50% off every deal.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Closing a file
Joined: Feb 18, 2001
Jun 23, 2004 11:05:00
In using Java IO classes, you often wrap lower level input/output stream to a higher level one. For example,
FileWriter lower = new FileWriter(filename); BufferedWriter higher = new BufferedWriter(osw);
What's the appropriate way of closing the file, do you close the file using
, or both?
author and iconoclast
Joined: Jul 08, 2003
Jun 23, 2004 11:36:00
The "wrapper" classes like
pass the close() call along to the "wrapped" object -- so calling upper.close() automatically calls lower.close() as well.
[Jess in Action]
Don't get me started about those stupid
subject: Closing a file
Couldn't move file just created earlier in the same program
Writing to a directory in a Unix environment
How to parse an XML document containing Chinese characters and get an XML bean
Trouble appending new data to an existing file
Opening files in append mode
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013