Why use buffers to read/write Streams
- by James Hay
Following reading various questions on reading and writing Streams, all the various answers define something like this as the correct way to do it:
private void CopyStream(Stream input, Stream output)
{
byte[] buffer = new byte[16 * 1024];
int read;
while ((read = input.Read(buffer, 0, buffer.Length)) > 0)
{
…