Meaningless Drivel is fun!*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes flush method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "flush method" Watch "flush method" New topic

flush method

Raju Champaklal
Ranch Hand

Joined: Dec 10, 2009
Posts: 521
ca anyone explain my why do we use flush method on output streams and what is buffering? i couldnt this while part from the k&b book

scjp 1.6 91%, preparing for scmad
"Time to get MAD now.. we will get even later" someone unknown
Ankit Garg

Joined: Aug 03, 2008
Posts: 9293

Raju Champaklal wrote:i couldnt this while part from the k&b book

What?? Didn't you miss a few words there

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Raju Champaklal
Ranch Hand

Joined: Dec 10, 2009
Posts: 521
it was a fill in the blanks problem...only with no blanks

please explain me the flush method....
Neha Daga
Ranch Hand

Joined: Oct 30, 2009
Posts: 504
flush method is used to make sure that every piece of data has been written out before you close the stream.

Buffering means rather than reading a unit data every time from the source a bunch of data is read and buffered (temporarily stored) in the buffered stream from where it is red one by one which saves us from complicated reading operations every time.
same is with buffered writing.

this is what i understood..but I think somewhere I am wrong, can somebody help me with these?

SCJP 1.6 96%
I agree. Here's the link:
subject: flush method