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

FlushToDisk(SafeFileHandle)

Flushes the operating system buffers for the given file to disk.

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.

SetLength(SafeFileHandle, Int64)

Sets the length of the file to the given value.

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