Class ReadStream
Reads the contents of a stream.
Implements
Inherited Members
Namespace: NanoByte.Common.Streams
Assembly: NanoByte.Common.dll
Syntax
public class ReadStream : TaskBase, ITask
Constructors
ReadStream(String, Stream, Action<Stream>)
Reads the contents of a stream.
Declaration
public ReadStream(string name, Stream stream, Action<Stream> callback)
Parameters
Type | Name | Description |
---|---|---|
String | name | A name describing the task in human-readable form. |
Stream | stream | The stream to read. |
Action<Stream> | callback | Called with a ProgressStream wrapped around the |
Properties
Name
A name describing the task in human-readable form.
Declaration
public override string Name { get; }
Property Value
Type | Description |
---|---|
String |
Overrides
UnitsByte
true
if UnitsProcessed and UnitsTotal are measured in bytes;
false
if they are measured in generic units.
Declaration
protected override bool UnitsByte { get; }
Property Value
Type | Description |
---|---|
Boolean |
Overrides
Methods
Execute()
The actual code to be executed.
Declaration
protected override void Execute()
Overrides
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
Type | Condition |
---|---|
System.OperationCanceledException | The operation was canceled. |
IOException | The task ended with IOError. |
WebException | The task ended with WebError. |