THPDFRandomAccessSource.TransferAt Method
Copies bytes starting at Offset into a destination stream in 64 KB chunks, handing back 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 at which reading starts |
Count | Number of bytes to transfer, clamped to whatever remains after Offset |
Destination | Stream that takes the copied bytes; must not be nil |
Return value
Number of bytes actually written to Destination; zero where Offset is negative, Count is not positive or Offset sits at or beyond the source size
Usage notes
- Raises
EArgumentNilExceptionwhereDestinationis nil andEStreamErrorwhere the underlyingReadAtreports an invalid chunk count - The copy loop stops early where
ReadAtreturns zero bytes, so short sources transfer only what is there - Override in derived sources so as to stream cached or network-backed data without staging it through an intermediate buffer