/// <inheritdoc/>
        protected override void BaseDecompress(Stream inputStream, Stream outputStream)
        {
            using var brotliStream = new Brotli.BrotliStream(inputStream, CompressionMode.Decompress, true);
            brotliStream.CopyTo(outputStream);

            outputStream.Flush();
            brotliStream.Flush();
        }
Example #2
0
 public void MemoryStreamShouldBeDecodable()
 {
     memoryStream.Position = 0;
     using (var bs = new BrotliStream(memoryStream, CompressionMode.Decompress))
         using (var msOutput = new MemoryStream())
         {
             bs.CopyTo(msOutput);
             msOutput.Seek(0, SeekOrigin.Begin);
             var output = msOutput.ToArray();
             Encoding.UTF8.GetString(output).ShouldEqual("onetwothree");
         }
 }
        /// <inheritdoc/>
        protected override byte[] BaseDecompress(byte[] compressedBytes)
        {
            using var inputStream = new MemoryStream(compressedBytes);
            using var outputStream = new MemoryStream();
            using (var brotliStream = new Brotli.BrotliStream(inputStream, CompressionMode.Decompress))
            {
                brotliStream.CopyTo(outputStream, compressedBytes.Length);

                outputStream.Flush();
                brotliStream.Flush();
            }
            return outputStream.ToArray();
        }