NanoByte.Common  2.9.0
NanoByte.Common.Streams.ProgressStream Class Reference

Decorator that adds progress-reporting and cancellation to another Stream. More...

Inheritance diagram for NanoByte.Common.Streams.ProgressStream:
NanoByte.Common.Streams.DelegatingStream

Public Member Functions

 ProgressStream (Stream underlyingStream, IProgress< long >? progress=null, CancellationToken cancellationToken=default)
 Creates a new progress-reporting stream. More...
 
override void SetLength (long value)
 Overrides the Stream.Length provided by the underlying stream. More...
 
override int Read (byte[] buffer, int offset, int count)
 
override void Write (byte[] buffer, int offset, int count)
 
override async Task< int > ReadAsync (byte[] buffer, int offset, int count, CancellationToken cancellationToken)
 
override async Task WriteAsync (byte[] buffer, int offset, int count, CancellationToken cancellationToken)
 
override int Read (Span< byte > buffer)
 
override async ValueTask< int > ReadAsync (Memory< byte > buffer, CancellationToken cancellationToken=default)
 
override void Write (ReadOnlySpan< byte > buffer)
 
override async ValueTask WriteAsync (ReadOnlyMemory< byte > buffer, CancellationToken cancellationToken=default)
 
- Public Member Functions inherited from NanoByte.Common.Streams.DelegatingStream
override void Flush ()
 
override long Seek (long offset, SeekOrigin origin)
 
override void SetLength (long value)
 
override int Read (byte[] buffer, int offset, int count)
 
override void Write (byte[] buffer, int offset, int count)
 
override Task FlushAsync (CancellationToken cancellationToken)
 
override Task< int > ReadAsync (byte[] buffer, int offset, int count, CancellationToken cancellationToken)
 
override Task WriteAsync (byte[] buffer, int offset, int count, CancellationToken cancellationToken)
 
override int Read (Span< byte > buffer)
 
override ValueTask< int > ReadAsync (Memory< byte > buffer, CancellationToken cancellationToken=default)
 
override void Write (ReadOnlySpan< byte > buffer)
 
override ValueTask WriteAsync (ReadOnlyMemory< byte > buffer, CancellationToken cancellationToken=default)
 

Properties

override long Length [get]
 
- Properties inherited from NanoByte.Common.Streams.DelegatingStream
override bool CanRead [get]
 
override bool CanSeek [get]
 
override bool CanWrite [get]
 
override long Length [get]
 
override bool CanTimeout [get]
 
override int ReadTimeout [get]
 
override int WriteTimeout [get]
 
override long Position [get, set]
 

Additional Inherited Members

- Protected Member Functions inherited from NanoByte.Common.Streams.DelegatingStream
 DelegatingStream (Stream underlyingStream)
 Creates a new delegating stream. More...
 
override void Dispose (bool disposing)
 
- Protected Attributes inherited from NanoByte.Common.Streams.DelegatingStream
readonly Stream UnderlyingStream
 Underlying stream to delegate to. More...
 

Detailed Description

Decorator that adds progress-reporting and cancellation to another Stream.

Constructor & Destructor Documentation

◆ ProgressStream()

NanoByte.Common.Streams.ProgressStream.ProgressStream ( Stream  underlyingStream,
IProgress< long >?  progress = null,
CancellationToken  cancellationToken = default 
)
inline

Creates a new progress-reporting stream.

Parameters
underlyingStreamUnderlying stream to delegate to. Will be disposed together with this stream.
progressUsed to report back the number of bytes that have been read or written.
cancellationTokenUsed to signal when the user wishes to cancel the stream. If signaled read an write requests will start throwing OperationCanceledException.

Member Function Documentation

◆ SetLength()

override void NanoByte.Common.Streams.ProgressStream.SetLength ( long  value)

Overrides the Stream.Length provided by the underlying stream.


The documentation for this class was generated from the following file: