Table of Contents

Class ReadStream

Namespace
NanoByte.Common.Streams
Assembly
NanoByte.Common.dll

Reads the contents of a stream.

public class ReadStream : TaskBase, ITask
Inheritance
ReadStream
Implements
Inherited Members
Extension Methods

Constructors

ReadStream(string, Stream, Action<Stream>)

Reads the contents of a stream.

public ReadStream(string name, Stream stream, Action<Stream> callback)

Parameters

name string

A name describing the task in human-readable form.

stream Stream

The stream to read.

callback Action<Stream>

Called with a ProgressStream wrapped around the stream.

Properties

Name

A name describing the task in human-readable form.

public override string Name { get; }

Property Value

string

UnitsByte

true if UnitsProcessed and UnitsTotal are measured in bytes; false if they are measured in generic units.

protected override bool UnitsByte { get; }

Property Value

bool

Methods

Execute()

The actual code to be executed.

protected override void Execute()

Remarks

State is automatically set to Started before calling this method, to Complete after a successful exit and to an appropriate error state in case on an exception. You can set additional TaskStates during execution.

Exceptions

OperationCanceledException

The operation was canceled.

IOException

The task ended with IOError.

WebException

The task ended with WebError.