wat is use of flush() fun in java
flush() function uses in java
Collapse
X
-
-
i don't know much about this flush() function..
i hve seen it most of the java programs...
so i would like to know about this that's all....
"System.out.flu sh()"Comment
-
ali akram
student
Mainly in Java flush() is used to empty the buffer data between the server and the client.
Syntex for using this function is:
private DataOutputStrea m toServer;
toServer = new DataOutputStrea m(socket.getOut putStream());
double radius =5.0;
// Send the radius to the server
toServer.writeD ouble(radius);
toServer.flush( );Comment
-
In java There will a buffer.when u write data to file or console it will initiall write to buffer then to file or console
Untill we use flush() method it will not be written into destination(fil e or console) from bufferComment
-
For performance issue, first data is to be written into Buffer. When buffer get full then data is written to output (File,console etc.). When buffer is partially filled and you want to send it to output(file,con sole) then you need to call flush() method manually in order to write partially filled buffer to output(file,con sole).Comment
Comment