What is the use of flash for a printwriter object?

I am looking for a theoretical analysis. I mean, how does the buffer system work and what is the use of using a flash? Please illustrate an example, if possible.

+4
source share
1 answer

When you write a text file, it BufferedWriterdoes not write it to disk immediately. Instead, it stores data in a buffer in memory.

This has the advantage that many small records will go into the buffer, and then the data will be written to disk at a time, i.e. with one big record, and not with many small records, which would be inefficient.

, BufferedWriter , .. , flush(), .

, flush() ?

  • . , , , , , , .

  • , flush(), .

flush(). close(), , flush() close() .

+6

All Articles