THPDFRandomAccessSource.TransferAt Method
Copies bytes starting at Offset into a destination stream in 64 KB chunks and returns the number of bytes transferred
Declaration
function TransferAt(Offset, Count: Int64;
Destination: TStream): Int64; virtual;
Unit
HPDFDoc
Parameters
| Name | Purpose |
|---|---|
Offset | Zero-based byte offset to start reading from |
Count | Number of bytes to transfer, clamped to the bytes remaining after Offset |
Destination | Stream that receives the copied bytes; must not be nil |
Return value
Number of bytes actually written to Destination; zero when Offset is negative, Count is not positive, or Offset is at or beyond the source size
Usage notes
- Raises
EArgumentNilExceptionwhenDestinationis nil andEStreamErrorwhen the underlyingReadAtreports an invalid chunk count - The copy loop stops early when
ReadAtreturns zero bytes, so short sources transfer only what exists - Override in derived sources to stream cached or network-backed data without staging it through an intermediate buffer