RandomAccess Class

Definition

Provides offset-based APIs for reading and writing files in a thread-safe manner.

public ref class RandomAccess abstract sealed
public static class RandomAccess
type RandomAccess = class
Public Class RandomAccess
Inheritance
RandomAccess

Remarks

Only regular disk files are supported. Unseekable files, like pipes, are not supported.

Methods

GetLength(SafeFileHandle)

Gets the length of the file in bytes.

Read(SafeFileHandle, IReadOnlyList<Memory<Byte>>, Int64)

Reads a sequence of bytes from given file at given offset.

Read(SafeFileHandle, Span<Byte>, Int64)

Reads a sequence of bytes from given file at given offset.

ReadAsync(SafeFileHandle, IReadOnlyList<Memory<Byte>>, Int64, CancellationToken)

Reads a sequence of bytes from given file at given offset.

ReadAsync(SafeFileHandle, Memory<Byte>, Int64, CancellationToken)

Reads a sequence of bytes from given file at given offset.

Write(SafeFileHandle, IReadOnlyList<ReadOnlyMemory<Byte>>, Int64)

Writes a sequence of bytes from given buffers to given file at given offset.

Write(SafeFileHandle, ReadOnlySpan<Byte>, Int64)

Writes a sequence of bytes from given buffer to given file at given offset.

WriteAsync(SafeFileHandle, IReadOnlyList<ReadOnlyMemory<Byte>>, Int64, CancellationToken)

Writes a sequence of bytes from given buffers to given file at given offset.

WriteAsync(SafeFileHandle, ReadOnlyMemory<Byte>, Int64, CancellationToken)

Writes a sequence of bytes from given buffer to given file at given offset.

Applies to

See also