Пример #1
0
 public byte[] Decompress(Stream inputStream)
 {
     using (var zlibStream = new ZlibStream(inputStream, CompressionMode.Decompress))
         using (var outputStream = new MemoryStream())
         {
             zlibStream.WriteTo(outputStream);
             return(outputStream.ToArray());
         }
 }
Пример #2
0
 public static byte[] Compress(byte[] data)
 {
     using (var inputStream = new MemoryStream(data))
         using (var compressionStream = new ZlibStream(inputStream, CompressionMode.Compress))
             using (var outputStream = new MemoryStream())
             {
                 compressionStream.WriteTo(outputStream);
                 return(outputStream.ToArray());
             }
 }