286 : this(
stream, mode, leaveOpen: false, -15, uncompressedSize)
291 : this(
stream, mode, leaveOpen: false)
296 : this(
stream, mode, leaveOpen, -15, -1
L)
301 : this(
stream, compressionLevel, leaveOpen: false)
306 : this(
stream, compressionLevel, leaveOpen, -15)
345 [MemberNotNull(
"_stream")]
359 [MemberNotNull(
"_buffer")]
365 [MemberNotNull(
"_buffer")]
402 bool flushSuccessful;
411 while (flushSuccessful);
437 return base.ReadByte();
495 ThrowStreamClosedException();
497 static void ThrowStreamClosedException()
507 ThrowCannotReadFromDeflateStreamException();
509 static void ThrowCannotReadFromDeflateStreamException()
519 ThrowCannotWriteToDeflateStreamException();
521 static void ThrowCannotWriteToDeflateStreamException()
646 if (deflateOutput > 0)
730 protected override void Dispose(
bool disposing)
766 base.Dispose(disposing);
776 return base.DisposeAsync();
881 if (deflateOutput > 0)
static ArrayPool< T > Shared
readonly Stream _destination
CopyToStream(DeflateStream deflateStream, Stream destination, int bufferSize)
readonly CancellationToken _cancellationToken
void CopyFromSourceToDestination()
override long Seek(long offset, SeekOrigin origin)
override int Read(byte[] buffer, int offset, int count)
async ValueTask WriteAsyncCore(ReadOnlyMemory< byte > buffer, CancellationToken cancellationToken)
override void SetLength(long value)
override void Write(byte[] buffer, int offset, int count)
async Task CopyFromSourceToDestinationAsync()
readonly DeflateStream _deflateStream
CopyToStream(DeflateStream deflateStream, Stream destination, int bufferSize, CancellationToken cancellationToken)
override ValueTask WriteAsync(ReadOnlyMemory< byte > buffer, CancellationToken cancellationToken=default(CancellationToken))
override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
override ValueTask< int > ReadAsync(Memory< byte > buffer, CancellationToken cancellationToken=default(CancellationToken))
void PurgeBuffers(bool disposing)
static void ThrowGenericInvalidData()
override void EndWrite(IAsyncResult asyncResult)
void EnsureBufferInitialized()
void InitializeDeflater(Stream stream, bool leaveOpen, int windowBits, CompressionLevel compressionLevel)
override Task< int > ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
void WriteDeflaterOutput()
override ValueTask DisposeAsync()
override void SetLength(long value)
override Task FlushAsync(CancellationToken cancellationToken)
override void Write(byte[] buffer, int offset, int count)
DeflateStream(Stream stream, CompressionMode mode, bool leaveOpen, int windowBits, long uncompressedSize=-1L)
ValueTask WriteAsyncMemory(ReadOnlyMemory< byte > buffer, CancellationToken cancellationToken)
override ValueTask WriteAsync(ReadOnlyMemory< byte > buffer, CancellationToken cancellationToken)
override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
override int EndRead(IAsyncResult asyncResult)
override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback? asyncCallback, object? asyncState)
override void Write(ReadOnlySpan< byte > buffer)
override void CopyTo(Stream destination, int bufferSize)
override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken)
DeflateStream(Stream stream, CompressionMode mode, long uncompressedSize)
unsafe void WriteCore(ReadOnlySpan< byte > buffer)
void AsyncOperationCompleting()
void EnsureCompressionMode()
static void ThrowInvalidBeginCall()
async ValueTask WriteDeflaterOutputAsync(CancellationToken cancellationToken)
void EnsureNoActiveAsyncOperation()
DeflateStream(Stream stream, CompressionLevel compressionLevel, bool leaveOpen)
void EnsureDecompressionMode()
DeflateStream(Stream stream, CompressionLevel compressionLevel, bool leaveOpen, int windowBits)
DeflateStream(Stream stream, CompressionMode mode)
DeflateStream(Stream stream, CompressionMode mode, bool leaveOpen)
async ValueTask PurgeBuffersAsync()
int _activeAsyncOperation
ValueTask< int > ReadAsyncMemory(Memory< byte > buffer, CancellationToken cancellationToken)
bool AsyncOperationIsActive
void AsyncOperationStarting()
DeflateStream(Stream stream, CompressionLevel compressionLevel)
override long Seek(long offset, SeekOrigin origin)
override int Read(Span< byte > buffer)
int ReadCore(Span< byte > buffer)
override int Read(byte[] buffer, int offset, int count)
override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback? asyncCallback, object? asyncState)
override void Dispose(bool disposing)
bool Finish(byte[] outputBuffer, out int bytesRead)
int GetDeflateOutput(byte[] outputBuffer)
unsafe void SetInput(ReadOnlyMemory< byte > inputBuffer)
bool Flush(byte[] outputBuffer, out int bytesRead)
void Dispose(bool disposing)
void SetInput(byte[] inputBuffer, int startIndex, int count)
unsafe bool Inflate(out byte b)
static void ValidateBufferArguments(byte[] buffer, int offset, int count)
static void ValidateCopyToArguments(Stream destination, int bufferSize)
Task WriteAsync(byte[] buffer, int offset, int count)
int Read(byte[] buffer, int offset, int count)
void CopyTo(Stream destination)
Task< int > ReadAsync(byte[] buffer, int offset, int count)
void Write(byte[] buffer, int offset, int count)
Task CopyToAsync(Stream destination)
virtual ValueTask DisposeAsync()
static string ObjectDisposed_StreamClosed
static string ArgumentOutOfRange_Enum
static string NotSupported_UnwritableStream
static string GenericInvalidData
static string NotSupported_UnreadableStream
static string InvalidBeginCall
static string CannotWriteToDeflateStream
static string CannotReadFromDeflateStream
static string NotSupported
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 FromException(Exception exception)
static Task FromCanceled(CancellationToken cancellationToken)
static Task CompletedTask
static void Write(ref bool location, bool value)
static CancellationToken None
static ValueTask FromCanceled(CancellationToken cancellationToken)
ConfiguredValueTaskAwaitable ConfigureAwait(bool continueOnCapturedContext)