NanoByte.Common  2.10.5
NanoByte.Common.Storage.ReadFile Class Reference

Reads a file from disk to a stream. More...

Inheritance diagram for NanoByte.Common.Storage.ReadFile:
NanoByte.Common.Tasks.TaskBase NanoByte.Common.Tasks.ITask

Public Member Functions

 ReadFile ([Localizable(false)] string path, Action< Stream > callback, [Localizable(true)] string? name=null)
 Creates a new file read task. More...
- Public Member Functions inherited from NanoByte.Common.Tasks.TaskBase
void Run (CancellationToken cancellationToken=default, ICredentialProvider? credentialProvider=null, IProgress< TaskSnapshot >? progress=null)
 Runs the task and blocks until it is complete.

Protected Member Functions

override void Execute ()
 The actual code to be executed.


override string Name [get]
override bool UnitsByte [get]
- Properties inherited from NanoByte.Common.Tasks.TaskBase
abstract string Name [get]
object? Tag [get, set]
virtual bool CanCancel [get]
TaskState State [get, protected set]
 The current State of the task. More...
abstract bool UnitsByte [get]
 true if UnitsProcessed and UnitsTotal are measured in bytes; false if they are measured in generic units. More...
long UnitsProcessed [get, set]
 The number of units that have been processed so far. More...
long UnitsTotal [get, set]
 The total number of units that are to be processed; -1 for unknown. More...
- Properties inherited from NanoByte.Common.Tasks.ITask
string Name [get]
 A name describing the task in human-readable form. More...
object? Tag [get, set]
 An object used to associate the task with a specific process; can be null. More...
bool CanCancel [get]
 Indicates whether this task can be canceled once it has been started. More...

Additional Inherited Members

- Protected Attributes inherited from NanoByte.Common.Tasks.TaskBase
CancellationToken CancellationToken
 Signaled when the user wishes to cancel the task execution. More...
 Used to retrieve credentials for specific Uris on demand; can be null. More...

Detailed Description

Reads a file from disk to a stream.

Constructor & Destructor Documentation

◆ ReadFile()

NanoByte.Common.Storage.ReadFile.ReadFile ( [Localizable(false)] string  path,
Action< Stream >  callback,
[Localizable(true)] string?  name = null 

Creates a new file read task.

pathThe path of the file to read.
callbackCalled with a stream providing the file content.
nameA name describing the task in human-readable form.

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