On Sun, Sep 20, 2015 at 4:48 PM, WALID BELRHALMIA <
wbelr...@gmail.com> wrote:
> what is the ddifference between bufio.NewReader and bufio.NewWriter that
> implement a buffer for the reader or writer . and bytes.buffer
bytes.Buffer is an in-memory buffer that you can Read() and Write()
to, it's just like an in-memory file.
The bufio package is used for wrapping io.Readers and io.Writers and
buffers data to reduce the number of Read() or Write() calls to the
underlying io.Reader or io.Writer.
eg. you can wrap an os.File in an bufio.NewReader so that not every
Read() needs to hit the disk allowing you to efficiently make Read()
calls for small numbers of bytes.