public static string UncompressString(byte[] compressed) { using (MemoryStream input = new MemoryStream(compressed)) { Stream decompressor = new GZipStream(input, CompressionMode.Decompress); return(ZLibBaseStream.UncompressString(compressed, decompressor)); } }
public static byte[] UncompressBuffer(byte[] compressed) { using (MemoryStream input = new MemoryStream(compressed)) { Stream decompressor = new DeflateStream(input, CompressionMode.Decompress); return(ZLibBaseStream.UncompressBuffer(compressed, decompressor)); } }
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()); } }
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()); } }
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); }
public GZipStream(Stream stream, CompressionMode mode, CompressionLevel level, bool leaveOpen) { this.m_baseStream = new ZLibBaseStream(stream, mode, level, ZlibStreamFlavor.GZIP, leaveOpen); }