RandomAccess 類別

定義

提供以位移為基礎的 API,以安全線程的方式讀取和寫入檔案。

public ref class RandomAccess abstract sealed
public static class RandomAccess
type RandomAccess = class
Public Class RandomAccess
繼承
RandomAccess

備註

僅支援一般磁碟檔案。 不支持無法看見的檔案,例如管道。

方法

FlushToDisk(SafeFileHandle)

將指定檔案的作業系統緩衝區排清到磁碟。

GetLength(SafeFileHandle)

取得檔案的長度 (以位元組為單位)。

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

從指定檔案讀取指定位移處的位元組序列。

Read(SafeFileHandle, Span<Byte>, Int64)

從指定檔案讀取指定位移處的位元組序列。

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

從指定檔案讀取指定位移處的位元組序列。

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

從指定檔案讀取指定位移處的位元組序列。

SetLength(SafeFileHandle, Int64)

將檔案的長度設定為指定的值。

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

將指定緩衝區中的位元組序列寫入指定位移的指定檔案。

Write(SafeFileHandle, ReadOnlySpan<Byte>, Int64)

將指定緩衝區中的位元組序列寫入指定位移處的指定檔案。

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

將指定緩衝區中的位元組序列寫入指定位移的指定檔案。

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

將指定緩衝區中的位元組序列寫入指定位移處的指定檔案。

適用於

另請參閱