Click or drag to resize

IFileTransferDataAsync Method

IT Hit User File System
Transfers data from remote sorage to user file system.

Namespace:  ITHit.FileSystem
Assembly:  ITHit.FileSystem (in ITHit.FileSystem.dll) Version: 1.4.4298.0
Task TransferDataAsync(
	long offset,
	long length,
	ITransferDataOperationContext operationContext,
	ITransferDataResultContext resultContext


Type: SystemInt64
File content offset, in bytes, to start reading from.
Type: SystemInt64
Data length to read, in bytes.
Type: ITHit.FileSystemITransferDataOperationContext
Provides additional parameters for this operation and information about the environment.
Type: ITHit.FileSystemITransferDataResultContext
Context for returning data to the platform and reporting operation progress and status.

Return Value

Type: Task

Called, when the file content should be transfetred from the remote torage to user file system. For example when the file should be hydrated.

To returned the transferred data to the operating system, call the ReturnData(Byte, Int64, Int64) method of the ITransferDataResultContext interface, passed via resultContext parameter.


The code below is part of 'VirtualFileSystem' C# sample provided with the SDK.

public async Task TransferDataAsync(long offset, long length, ITransferDataOperationContext operationContext, ITransferDataResultContext resultContext)
    // This method has a 60 sec timeout. 
    // To process longer requests and reset the timout timer call resultContext.ReportProgress() method.

    Logger.LogMessage($"IFile.TransferDataAsync({offset}, {length})", UserFileSystemPath);

    SimulateNetworkDelay(length, resultContext);

    long optionalLength = length + operationContext.OptionalLength;

    byte[] buffer = await new UserFile(UserFileSystemPath).ReadAsync(offset, optionalLength);

    resultContext.ReturnData(buffer, offset, optionalLength);
See Also