jQuery in Action, 3rd edition
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Doubt about IO package Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Doubt about IO package" Watch "Doubt about IO package" New topic

Doubt about IO package

vivekkumar sharma
Ranch Hand

Joined: Dec 21, 2005
Posts: 70
Hi Ranchers,

In the following code I get IOexception : Stream already closed.
It works fine if i comment line 1 below.

I am not sure how buffered writer works.
Can some one explain, does BufferedWriter open FileWriter dtream before writing or not.


wise owen
Ranch Hand

Joined: Feb 02, 2006
Posts: 2023
In BufferedWriter.java code, its write function does not open file.
Henry Wong

Joined: Sep 28, 2004
Posts: 20519

Furthermore, in order for the BufferedWriter to work "properly", you should not be writing directly to the FileWriter.


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
I agree. Here's the link: http://aspose.com/file-tools
subject: Doubt about IO package
jQuery in Action, 3rd edition