java io streams
1 posts in topic
Flat View  Flat View

Posted By:   Rajinder_Singh
Posted On:   Sunday, October 29, 2006 07:04 PM

in java when ::

FileWriter fw=new FileWriter("arr.txt");

BufferedWriter bw=new BufferedWriter(fw);

PrintWriter p=new PrintWriter(bw);


fff should be written to file arr.txt but when arr.txt is opened there is no content in file why??

( i have not closed the streams but on closing streams file is showing its contents ie.fff)why?

Re: java io streams

Posted By:   Christopher_Koenigsberg  
Posted On:   Saturday, November 4, 2006 06:51 PM

You created a BufferedWriter. That means when you write, it goes through a buffer, and if you write one bufferful or less of data, it doesn't actually make it out to the file, until the buffer is flushed.

When you closed the writers, that flushed the buffer for you.
About | Sitemap | Contact