示例#1
0
 public static string UncompressString(byte[] compressed)
 {
     using (MemoryStream input = new MemoryStream(compressed))
     {
         Stream decompressor = new GZipStream(input, CompressionMode.Decompress);
         return(ZLibBaseStream.UncompressString(compressed, decompressor));
     }
 }
示例#2
0
        public static byte[] UncompressBuffer(byte[] compressed)
        {
            using (MemoryStream input = new MemoryStream(compressed))
            {
                Stream decompressor =
                    new DeflateStream(input, CompressionMode.Decompress);

                return(ZLibBaseStream.UncompressBuffer(compressed, decompressor));
            }
        }
示例#3
0
 public static byte[] CompressString(string s)
 {
     using (MemoryStream ms = new MemoryStream())
     {
         Stream compressor =
             new DeflateStream(ms, CompressionMode.Compress, CompressionLevel.BestCompression);
         ZLibBaseStream.CompressString(s, compressor);
         return(ms.ToArray());
     }
 }
示例#4
0
        public static byte[] CompressBuffer(byte[] b)
        {
            using (MemoryStream ms = new MemoryStream())
            {
                Stream compressor =
                    new GZipStream(ms, CompressionMode.Compress, CompressionLevel.BestCompression);

                ZLibBaseStream.CompressBuffer(b, compressor);
                return(ms.ToArray());
            }
        }
示例#5
0
 public DeflateStream(Stream stream, CompressionMode mode, CompressionLevel level, bool leaveOpen)
 {
     this.m_innerStream = stream;
     this.m_baseStream  = new ZLibBaseStream(stream, mode, level, ZlibStreamFlavor.DEFLATE, leaveOpen);
 }
示例#6
0
 public GZipStream(Stream stream, CompressionMode mode, CompressionLevel level, bool leaveOpen)
 {
     this.m_baseStream = new ZLibBaseStream(stream, mode, level, ZlibStreamFlavor.GZIP, leaveOpen);
 }