Exemple #1
0
        public static void DecompressFile(string inFile, string outFile)
        {
            var buffer = new byte[1 << 20];

            using (var ins = new XZDecompressStream(inFile))
                using (var outs = new FileStream(outFile, FileMode.CreateNew))
                {
                    while (true)
                    {
                        var cnt = ins.Read(buffer, 0, buffer.Length);
                        outs.Write(buffer, 0, cnt);
                        if (cnt < buffer.Length)
                        {
                            break;
                        }
                    }
                }
        }
Exemple #2
0
        private void TestDispose()
        {
            var c = new XZCompressStream("temp1.xz");
            c.Close();
            c.Close();

            c = new XZCompressStream("temp2.xz");
            c.Dispose();
            c.Dispose();

            var d = new XZDecompressStream("temp1.xz");
            d.Close();
            d.Close();

            d = new XZDecompressStream("temp2.xz");
            d.Dispose();
            d.Dispose();
        }
Exemple #3
0
 public static void DecompressFile(string inFile, string outFile)
 {
     var buffer = new byte[1 << 20];
     using (var ins = new XZDecompressStream(inFile))
     using (var outs = new FileStream(outFile, FileMode.CreateNew))
     {
         while (true)
         {
             var cnt = ins.Read(buffer, 0, buffer.Length);
             outs.Write(buffer, 0, cnt);
             if (cnt < buffer.Length)
                 break;
         }
     }
 }