flush() function uses in java

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kaleeswaran
    New Member
    • Mar 2007
    • 132

    flush() function uses in java

    wat is use of flush() fun in java
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by kaleeswaran
    wat is use of flush() fun in java
    Be more specific. What flush fun are you talking about?

    Comment

    • kaleeswaran
      New Member
      • Mar 2007
      • 132

      #3
      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

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        Originally posted by kaleeswaran
        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()"
        Read about it here .

        Comment

        • ali akram

          #5
          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

          • Thejas
            New Member
            • Nov 2011
            • 1

            #6
            Originally posted by r035198x
            Be more specific. What flush fun are you talking about?
            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 buffer

            Comment

            • Nicool
              New Member
              • Nov 2011
              • 1

              #7
              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

              • hsn81321
                New Member
                • Sep 2012
                • 1

                #8
                Thanks

                Thanks Ali Akram for your example.

                Comment

                Working...