Read
Document management, Performance, Concurrency
Description
Reads up to Count bytes at the current cursor position into Buffer and advances the cursor by the number of bytes copied
Bytes come from the aligned chunk cache; a miss fetches the containing chunk from the backing source, and concurrent readers of the same chunk share one fetch
Syntax
Delphi
Function TByteRangeStream.Read(Var Buffer; Count: Longint): Longint; Override;Parameters
| Buffer | The destination for the returned bytes |
|---|---|
| Count | The maximum number of bytes to read |
Return values
| 0 | Count is zero or negative, the cursor is at the source end, or the source request failed |
|---|---|
| >0 | The number of bytes copied to Buffer; the request is shortened when it reaches the source end |
Remarks
This is the TStream positional read; the cursor has its own lock, so concurrent Read calls are serialized while ReadAt callers proceed independently
Unlike ReadAt, a positional read never waits for the coalesce window before fetching an uncached chunk
See also
TByteRangeStreamReadAt, TByteRangeStreamAvailability, LoadFromRangeSource