FileStream流媒体

class Program
    {
        static void Main(string[] args)
        {
            string source = @"mana.mp4";
            string target = @"fu.mp4";
            CopyFile(source, target);
            Console.WriteLine("复制成功");
            Console.ReadKey();
        }
        public static void CopyFile(string soucre, string target)
        {
            FileStream fsRead = new FileStream(soucre, FileMode.Open, FileAccess.Read);
            FileStream fsWrite = new FileStream(target,FileMode.OpenOrCreate,FileAccess.Write);
            byte[] buffer = new byte[1024*1024*5];
            while (true)
            {
                int r = fsRead.Read(buffer, 0, buffer.Length);
                if (r == 0)
                {
                    break;
                }
                fsWrite.Write(buffer, 0, r);
            }
        }
    }
原文地址:https://www.cnblogs.com/ashidamana/p/5039077.html