示例#1
0
        public long DotNetDeflate()
        {
            using (var output = new MemoryStream())
            {
                using (var deflate = new DotNetZlibDeflateStream(output, this.Compression))
                {
                    var buffer = data;
                    deflate.Write(buffer, 0, buffer.Length);
                }

                return(output.Length);
            }
        }
        public long DotNetDeflate()
        {
            // DeflateStream does not actually provide this level of compression
            // maxing out at 6 Optimal.
            if (this.Compression == 9)
            {
                return(-1);
            }

            using (var output = new MemoryStream())
            {
                // Defaults to compression -1, buffer 512.
                using (var deflate = new DotNetZlibDeflateStream(output, this.Compression))
                {
                    deflate.Write(this.data, 0, this.data.Length);
                }

                return(output.Length);
            }
        }