79 : this(
stream, compressionLevel, leaveOpen: false)
121 if (bytesWritten > 0)
125 if (bytesConsumed > 0)
172 int bytesConsumed = 0;
173 int bytesWritten = 0;
179 if (bytesConsumed > 0)
183 if (bytesWritten > 0)
211 if (bytesWritten > 0)
247 int bytesWritten = 0;
253 if (bytesWritten > 0)
371 if (bytesConsumed != 0)
398 : this(
stream, mode, leaveOpen: false)
439 protected override void Dispose(
bool disposing)
443 if (disposing &&
_stream !=
null)
458 base.Dispose(disposing);
static ArrayPool< T > Shared
void EnsureNoActiveAsyncOperation()
void ReleaseStateForDispose()
override void Dispose(bool disposing)
void WriteCore(ReadOnlySpan< byte > buffer, bool isFinalBlock=false)
override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback? asyncCallback, object? asyncState)
async Task FlushAsyncCore(CancellationToken cancellationToken)
override Task FlushAsync(CancellationToken cancellationToken)
override ValueTask< int > ReadAsync(Memory< byte > buffer, CancellationToken cancellationToken=default(CancellationToken))
override ValueTask WriteAsync(ReadOnlyMemory< byte > buffer, CancellationToken cancellationToken=default(CancellationToken))
readonly CompressionMode _mode
void AsyncOperationStarting()
override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
override void EndWrite(IAsyncResult asyncResult)
async ValueTask WriteAsyncMemoryCore(ReadOnlyMemory< byte > buffer, CancellationToken cancellationToken, bool isFinalBlock=false)
static void ThrowInvalidStream()
override int Read(Span< byte > buffer)
int _activeAsyncOperation
override int EndRead(IAsyncResult asyncResult)
static void ThrowInvalidBeginCall()
BrotliStream(Stream stream, CompressionMode mode, bool leaveOpen)
override long Seek(long offset, SeekOrigin origin)
BrotliStream(Stream stream, CompressionLevel compressionLevel, bool leaveOpen)
BrotliStream(Stream stream, CompressionLevel compressionLevel)
BrotliStream(Stream stream, CompressionMode mode)
override void WriteByte(byte value)
override void SetLength(long value)
override int Read(byte[] buffer, int offset, int count)
override Task< int > ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
bool TryDecompress(Span< byte > destination, out int bytesWritten)
override void Write(ReadOnlySpan< byte > buffer)
override void Write(byte[] buffer, int offset, int count)
override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback? asyncCallback, object? asyncState)
bool AsyncOperationIsActive
void AsyncOperationCompleting()
override async ValueTask DisposeAsync()
static int GetQualityFromCompressionLevel(CompressionLevel level)
static void ValidateBufferArguments(byte[] buffer, int offset, int count)
Task WriteAsync(byte[] buffer, int offset, int count)
int Read(byte[] buffer, int offset, int count)
Task< int > ReadAsync(byte[] buffer, int offset, int count)
void Write(byte[] buffer, int offset, int count)
virtual ValueTask DisposeAsync()
static string BrotliStream_Compress_UnsupportedOperation
static string ObjectDisposed_StreamClosed
static string Stream_FalseCanRead
static string ArgumentOutOfRange_Enum
static string BrotliStream_Decompress_InvalidData
static string Stream_FalseCanWrite
static string BrotliStream_Compress_InvalidData
static string InvalidBeginCall
static string BrotliStream_Decompress_UnsupportedOperation
static string BrotliStream_Decompress_InvalidStream
static int Exchange(ref int location1, int value)
static IAsyncResult Begin(Task task, AsyncCallback callback, object state)
static void End(IAsyncResult asyncResult)
new ConfiguredTaskAwaitable< TResult > ConfigureAwait(bool continueOnCapturedContext)
static Task FromCanceled(CancellationToken cancellationToken)
static Task CompletedTask
static void Write(ref bool location, bool value)
unsafe OperationStatus Decompress(ReadOnlySpan< byte > source, Span< byte > destination, out int bytesConsumed, out int bytesWritten)
OperationStatus Flush(Memory< byte > destination, out int bytesWritten)
void SetQuality(int quality)
SafeBrotliEncoderHandle _state
OperationStatus Compress(ReadOnlyMemory< byte > source, Memory< byte > destination, out int bytesConsumed, out int bytesWritten, bool isFinalBlock)
void CopyTo(Span< T > destination)
static CancellationToken None
static ValueTask FromCanceled(CancellationToken cancellationToken)
ConfiguredValueTaskAwaitable ConfigureAwait(bool continueOnCapturedContext)