THPDFRandomAccessSource.ReadAtCancellable Method
Reads bytes at Offset, observing a cancellation token both before and after the underlying read
Declaration
function ReadAtCancellable(Offset: Int64; var Buffer; Count: Longint;
CancellationToken: THPDFCancellationToken): Longint; virtual;
Unit
HPDFDoc
Parameters
| Name | Purpose |
|---|---|
Offset | Zero-based byte offset from which to read |
Buffer | Untyped buffer into which the bytes go |
Count | Greatest number of bytes to read |
CancellationToken | Token polled for cancellation, or nil so as to read without cancellation checks |
Return value
Number of bytes read, exactly as ReadAt reports it
Usage notes
- The base implementation raises the cancellation exception before and after
ReadAtwhenever the token is signalled - Override in slow sources such as network or archive-backed inputs so as to poll the token between transport chunks
- Deterministic replay wraps this method so that recorded runs reproduce the same cancellation decisions