![]() It will write to temp.txt in the current directory. Example: With Default Buffer Size of 4096 bytes We are using writer.Available() and writer.Buffered() to print the available and used buffer size respectively. ![]() Let’s see an example of a write to a file. If there is no buffer then there will be IO write on every line. Since it 3500 + 1000 > 4096, it will write some of the bytes to file so that some buffer is available for next write. The next line to be written is of 1000 bytes. For example, let’s say it has 3500 bytes in full in buffer and buffer has a size of 4096. The main advantage of buffered write is that it keeps the data to be written in the buffer and thus minimizes the number of times we have to do the IO operation. It has a default buffer size of 4096 bytes however a custom buffer size can also be specified.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |