Write() публичный Метод

learn from 01_compress_easy.c
public Write ( byte buffer, int offset, int count ) : void
buffer byte
offset int
count int
Результат void
Пример #1
0
        public static void CompressFile(string inFile, string outFile, FileMode mode = FileMode.Create, int threads = 1, int level = 6)
        {
            var buffer = new byte[1 << 20];

            using (var ins = new FileStream(inFile, FileMode.Open))
                using (var outs = new XZCompressStream(outFile, threads, level, mode))
                {
                    while (true)
                    {
                        var cnt = ins.Read(buffer, 0, buffer.Length);
                        outs.Write(buffer, 0, cnt);
                        if (cnt < buffer.Length)
                        {
                            break;
                        }
                    }
                }
        }
Пример #2
0
 public static void CompressFile(string inFile, string outFile, FileMode mode = FileMode.Create, int threads = 1, int level = 6)
 {
     var buffer = new byte[1 << 20];
     using (var ins = new FileStream(inFile, FileMode.Open))
     using (var outs = new XZCompressStream(outFile, threads, level, mode))
     {
         while (true)
         {
             var cnt = ins.Read(buffer, 0, buffer.Length);
             outs.Write(buffer, 0, cnt);
             if (cnt < buffer.Length)
                 break;
         }
     }
 }