When to use .NET BufferedStream class?

前端 未结 6 723
误落风尘
误落风尘 2020-12-01 05:05

The MSDN site states:

A buffer is a block of bytes in memory used to cache data, thereby reducing the number of calls to the operating system. B

6条回答
  •  生来不讨喜
    2020-12-01 05:34

    The normal file I/O streams are already buffered by using a StreamReader/StreamWriter.

    Since read/write operations on streams, normally use the Read/Write methods that take a byte array, you will naturally provide some buffering yourself.

    If you use very small arrays, or use WriteByte, you might get better performance by using a BufferedStream in between.

提交回复
热议问题