public byte[] ToArray() { MemoryStream result = new MemoryStream(); if (_position < _limit) { result.Write(_buffer, _position, _limit - _position); _position = _limit; } StreamUtility.AppendTo(_stream, result, 0); return(result.ToArray()); }
public static byte[] Decompress ( [NotNull] byte[] data ) { Sure.NotNull(data, nameof(data)); MemoryStream memory = new MemoryStream(data); using (DeflateStream decompresser = new DeflateStream ( memory, CompressionMode.Decompress )) { MemoryStream result = new MemoryStream(); StreamUtility.AppendTo(decompresser, result, 0); decompresser.Dispose(); return(result.ToArray()); } }