Beispiel #1
0
        /// <summary>
        /// 解压
        /// </summary>
        public static ArraySegment <byte> Decompress(ArraySegment <byte> source)
        {
            if (source == null || source.Array == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            using (MemoryStream sourceStream = new MemoryStream(source.Array))
                using (DeflateStream decompressStream = new DeflateStream(sourceStream, CompressionMode.Decompress, true))
                {
                    return(new ArraySegment <byte>(decompressStream.ToArray()));
                }
        }