Copy Stream - CSharp File IO

CSharp examples for File IO:File Command

Description

Copy Stream

Demo Code


using System.Web;
using System.Linq;
using System.IO;//from  w w w  .  jav  a  2s .  c om
using System.Collections.Generic;
using System;

public class Main{
        public static void CopyStream(Stream input, Stream output)
        {
            byte[] buffer = new byte[8 * 1024];
            int len;
            while ((len = input.Read(buffer, 0, buffer.Length)) > 0)
            {
                output.Write(buffer, 0, len);
            }
        }
}

Related Tutorials