Class OdfDirectIoReadableStream
Provides a read-only stream optimized for Direct I/O file access when the platform supports it. 提供在平台支援時使用 Direct I/O 檔案存取最佳化的唯讀資料流。
public sealed class OdfDirectIoReadableStream : Stream, IDisposable, IAsyncDisposable
- Inheritance
-
OdfDirectIoReadableStream
- Implements
- Inherited Members
Constructors
OdfDirectIoReadableStream(string)
Initializes a new instance of the OdfDirectIoReadableStream class. 初始化 OdfDirectIoReadableStream 類別的新執行個體。
public OdfDirectIoReadableStream(string filePath)
Parameters
filePathstringThe path of the file to read. / 要讀取的檔案路徑。
Properties
CanRead
Provides the CanRead member. 提供 CanRead 成員。
public override bool CanRead { get; }
Property Value
CanSeek
Provides the CanSeek member. 提供 CanSeek 成員。
public override bool CanSeek { get; }
Property Value
CanWrite
Provides the CanWrite member. 提供 CanWrite 成員。
public override bool CanWrite { get; }
Property Value
Length
Provides the Length member. 提供 Length 成員。
public override long Length { get; }
Property Value
Position
Gets or sets the current stream position. 取得或設定目前資料流位置。
public override long Position { get; set; }
Property Value
Methods
Dispose(bool)
Releases unmanaged resources. 釋放非受控資源。
protected override void Dispose(bool disposing)
Parameters
disposingbool
Flush()
Performs flush. 執行 Flush。
public override void Flush()
Read(byte[], int, int)
Performs the Read operation. 執行 Read 作業。
public override int Read(byte[] buffer, int offset, int count)
Parameters
Returns
Read(Span<byte>)
Performs the Read operation. 執行 Read 作業。
public override int Read(Span<byte> buffer)
Parameters
Returns
ReadAsync(byte[], int, int, CancellationToken)
Reads async. 讀取 Async。
public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
Parameters
bufferbyte[]offsetintcountintcancellationTokenCancellationToken
Returns
Remarks
Completes synchronously when the requested data is already prefetched; otherwise the blocking read is dispatched to the thread pool so the caller thread is never blocked. 當要求的資料已在預讀緩衝區內時同步完成;否則將阻塞式讀取排入執行緒集區執行,避免以同步讀取偽裝非同步而阻塞呼叫端執行緒。
ReadAsync(Memory<byte>, CancellationToken)
Reads async. 讀取 Async。
public override ValueTask<int> ReadAsync(Memory<byte> buffer, CancellationToken cancellationToken)
Parameters
bufferMemory<byte>cancellationTokenCancellationToken
Returns
Remarks
Completes synchronously when the requested data is already prefetched; otherwise the blocking read is dispatched to the thread pool so the caller thread is never blocked. 當要求的資料已在預讀緩衝區內時同步完成;否則將阻塞式讀取排入執行緒集區執行,避免以同步讀取偽裝非同步而阻塞呼叫端執行緒。
Seek(long, SeekOrigin)
Performs seek. 執行 Seek。
public override long Seek(long offset, SeekOrigin origin)
Parameters
offsetlongoriginSeekOrigin
Returns
SetLength(long)
Sets length. 設定 Length。
public override void SetLength(long value)
Parameters
valuelong
Write(byte[], int, int)
Performs the Write operation. 執行 Write 作業。
public override void Write(byte[] buffer, int offset, int count)