RandomAccess 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
提供基於偏移量的 API,以執行緒安全的方式讀寫檔案。
public ref class RandomAccess abstract sealed
public static class RandomAccess
type RandomAccess = class
Public Class RandomAccess
- 繼承
-
RandomAccess
備註
僅支援一般磁碟檔案。 不可尋址檔案,如管道,則不被支援。
方法
| 名稱 | Description |
|---|---|
| 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) |
從指定緩衝區寫入一串位元組到指定偏移量的檔案。 |