• Post Reply Bookmark Topic Watch Topic
  • New Topic

Doubt about IO package

 
vivekkumar sharma
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

TA
Vivek

 
wise owen
Ranch Hand
Posts: 2023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In BufferedWriter.java code, its write function does not open file.
 
Henry Wong
author
Sheriff
Posts: 22629
111
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Furthermore, in order for the BufferedWriter to work "properly", you should not be writing directly to the FileWriter.

Henry
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!