I need to know what is exact difference between flush and close function in Java?
And When the data is dumped into a file during writing of file?
Please prov
flush()
:To flush output stream, use void flush()
method of DataOutputStream
class. This method internally calls flush()
method of underlying OutputStream
class which forces any buffered output bytes to be written in the stream.
close()
:It generally close the Stream,connection,socket.
See flush and close example