Example #1
0
 public override ValueTask WriteAsync(ReadOnlyMemory <byte> source, CancellationToken cancellationToken = default(CancellationToken))
 {
     if (GetType() != typeof(GZipStream))
     {
         // GZipStream is not sealed, and a derived type may have overridden WriteAsync(byte[], int, int) prior
         // to this WriteAsync(ReadOnlyMemory<byte>) overload being introduced.  In that case, this
         // WriteAsync(ReadOnlyMemory<byte>) overload should use the behavior of Write(byte[],int,int) overload.
         return(base.WriteAsync(source, cancellationToken));
     }
     else
     {
         CheckDeflateStream();
         return(_deflateStream.WriteAsyncMemory(source, cancellationToken));
     }
 }