Beispiel #1
0
 public static void WriteToGzip(this IEnumerable <byte> array, string file)
 {
     using (var gzip = new ICSharpCode.SharpZipLib.GZip.GZipOutputStream(File.Create(file + ".gz")))
     {
         gzip.SetLevel(9);
         var buffer = array.ToArray();
         gzip.Write(buffer, 0, buffer.Length);
     }
 }
Beispiel #2
0
        private void _CompressGZ(string pathFileTAR, IDTSComponentEvents componentEvents)
        {
            using (ICSharpCode.SharpZipLib.GZip.GZipOutputStream gzip = new ICSharpCode.SharpZipLib.GZip.GZipOutputStream(System.IO.File.Create(pathFileTAR)))
            {
                gzip.SetLevel(9);
                _CompressTAR(pathFileTAR, componentEvents, gzip);
                //gzip.Flush();
                //gzip.Close();
            }

            _Check_GZ(pathFileTAR, componentEvents);
        }
Beispiel #3
0
        public void StoreEntries(IEnumerable <string> entries)
        {
            using (var compressedStream = bucketStreamProvider.OpenWrite(address))
                using (var zip = new ICSharpCode.SharpZipLib.GZip.GZipOutputStream(compressedStream))
                    using (var bw = new BinaryWriter(zip))
                    {
                        zip.SetLevel(9);
                        bw.Write((int)entries.Count());

                        foreach (var e in entries)
                        {
                            var bytes = Encoding.UTF8.GetBytes(e);
                            bw.Write((int)bytes.Length);
                            zip.Write(bytes, 0, bytes.Length);
                        }
                    }
        }