public static byte[] UncompressBuffer(byte[] compressed) { byte[] result; using (MemoryStream memoryStream = new MemoryStream(compressed)) { Stream decompressor = new DeflateStream(memoryStream, CompressionMode.Decompress); result = ZlibBaseStream.UncompressBuffer(compressed, decompressor); } return(result); }
/// <summary> /// Uncompress a ZLIB-compressed byte array into a byte array. /// </summary> /// /// <seealso cref="ZlibStream.CompressBuffer(byte[])"/> /// <seealso cref="ZlibStream.UncompressString(byte[])"/> /// /// <param name="compressed"> /// A buffer containing ZLIB-compressed data. /// </param> /// /// <returns>The data in uncompressed form</returns> public static byte[] UncompressBuffer(byte[] compressed) { using (var input = new MemoryStream(compressed)) { Stream decompressor = new ZlibStream(input, CompressionMode.Decompress); return(ZlibBaseStream.UncompressBuffer(compressed, decompressor)); } }