0

I want to know the exact working of BufferReader / BufferInputStream and BufferWriter / BufferOutputStream. like how will it speed up reading or writing process. in some sites they say it attaches a buffer to speed up the process .. what attaching a buffer mean? how will it speed up the process? In some sites they say instead of reading 1 byte it reads more than one byte at a time. what exactly it means when they say reading. is it transfer of data from harddisk to RAM?

This question is haunting me since three days. Please some one give me a fitting answer

  • 1
    this might clarify some of your questions https://docs.oracle.com/javase/tutorial/essential/io/buffers.html – 7663233 Mar 23 '17 at 09:34
  • Buffered reader and writer are exactly what those "other" sites say: they buffer requests of read and write in chunks. They do not speed up anything per se, because it still may be faster yet to read/write single bytes at a time, depending on where you are reading from. It is unspecified whether that would be harddisk, RAM, because you can get readers and streams for almost anything in Java. Those "other" sites say about speed up, because *in general* it is faster to read some byteword, because setting up a read request **usually** takes more work than actually reading bytes – M. Prokhorov Mar 23 '17 at 09:35

0 Answers0