WriteAsync() public méthode

public WriteAsync ( byte array, int offset, int count, System cancellationToken ) : System.Threading.Tasks.Task
array byte
offset int
count int
cancellationToken System
Résultat System.Threading.Tasks.Task
Exemple #1
0
        public void Precancellation()
        {
            var ms = new MemoryStream();

            using (Stream compressor = new DeflateStream(ms, CompressionMode.Compress, leaveOpen: true))
            {
                Assert.True(compressor.WriteAsync(new byte[1], 0, 1, new CancellationToken(true)).IsCanceled);
                Assert.True(compressor.FlushAsync(new CancellationToken(true)).IsCanceled);
            }
            using (Stream decompressor = CreateStream(ms, CompressionMode.Decompress, leaveOpen: true))
            {
                Assert.True(decompressor.ReadAsync(new byte[1], 0, 1, new CancellationToken(true)).IsCanceled);
            }
        }
Exemple #2
0
 public override Task WriteAsync(Byte[] array, int offset, int count, CancellationToken cancellationToken)
 {
     CheckDeflateStream();
     return(_deflateStream.WriteAsync(array, offset, count, cancellationToken));
 }