In C/C++ prgs we could "flush" the io streams,......... is it possible in Java ?....Firstly is their any need to perform flushing explictly OR Java does it on its own and if yes then how does it do that ?
Thanks and Regards
Omkar Patkar (SCJP 1.4)[url]http://javacollectionsnotes.blogspot.com[/url] | [url]http://omkar-myscjpexp.blogspot.com[/url]
The OutputStream class has a flush() method that you can call to flush the stream. Notice that InputStream does not have any such method since there is no reason to flush an InputStream.
It is best to flush explicitly, but there are some cases where Java will do it for you:
1) OutputStream.close() calls OutputStream.flush() before closing the stream.
2) Java *might* flush the stream at other times. For example, if you are using a BufferedOutputStream, the stream will flush itself automatically if the buffer is filled. I guess there might be other situations where this will happen as well, but I can't think of any off the top of my head.