FileExt.Read Method
Reads bytes from a file asynchronously. Multiple file locations are supported:
- Files in streamingAssetsPath
- Files in an http:// location
- Files in a file:// location
Namespace: UltimateXR.Extensions.System.IO
Assembly: UltimateXR (in UltimateXR.dll) Version: 0.0.0.0
Syntax
C#
public static Task<byte[]> Read(
string uri,
CancellationToken ct = default
)
Parameters
- uri
- Type: System.String
File full path to be opened for reading - ct (Optional)
- Type: System.Threading.CancellationToken
Optional cancellation token, to be able to cancel the asynchronous operation
Return Value
Exceptions
| Exception | Condition |
|---|---|
| OperationCanceledException | Task canceled using ct |
| FileNotFoundException | The file specified in uri was not found. |
| NotSupportedException | uri is in an invalid format. |
| IOException | An I/O error occurred while opening the file. |
| InvalidOperationException | The stream is currently in use by a previous read operation. |
Remarks
UnityWebRequest.Get() is used internally to perform the actual reading