/// <inheritdoc/>
        protected override async Task BaseDecompressAsync(Stream inputStream, Stream outputStream, CancellationToken cancellationToken = default)
        {
            using var brotliStream = new Brotli.BrotliStream(inputStream, CompressionMode.Decompress, true);
            await brotliStream.CopyToAsync(outputStream, DefaultBufferSize, cancellationToken).ConfigureAwait(false);

            await outputStream.FlushAsync(cancellationToken).ConfigureAwait(false);
            await brotliStream.FlushAsync(cancellationToken).ConfigureAwait(false);
        }
예제 #2
0
        /// <inheritdoc/>
        protected override async Task BaseCompressAsync(Stream inputStream, Stream outputStream, CancellationToken cancellationToken = default)
        {
            using (var brotliStream = new Brotli.BrotliStream(outputStream, CompressionMode.Compress))
            {
                brotliStream.SetQuality(Quality);
                brotliStream.SetWindow(Window);
                await inputStream.CopyToAsync(brotliStream, DefaultBufferSize, cancellationToken).ConfigureAwait(false);

                await inputStream.FlushAsync(cancellationToken).ConfigureAwait(false);

                await brotliStream.FlushAsync(cancellationToken).ConfigureAwait(false);
            }
        }