HPDFTransferStream Function
Transfers bytes from the current source position to the current destination position and avoids an intermediate copy for supported storage types
Declaration
function HPDFTransferStream(
Source, Destination: TStream;
Count: Int64 = -1): Int64;
Unit
HPDFObjs
Transfer paths
TMemoryStreamwrites directly from its backing pointer without allocating a transfer bufferTFileStreamwrites directly from bounded read-only mapped views and falls back automatically when mapping is unavailableTHPDFMappedFileStreamand source-backedTHPDFLazyFileStreamwrite directly from resident mapped windows- Random-access streams delegate to
THPDFRandomAccessSource.TransferAt, whilstTHPDFCoalescingRandomAccessSourcewrites retained cache blocks directly - Other stream classes use a bounded 64 KiB fallback buffer
Count and positions
A Count of -1 transfers all bytes remaining from the current source position, zero transfers nothing, and a positive value is capped at the available bytes; values below -1 are rejected
Both stream positions advance by the number of bytes returned; source and destination must be different non-nil objects
PDF writer integration
Unencrypted PDF stream bodies, filter-free decoded output, raw loaded-image export, lazy-stream materialisation, and adaptive temporary-stream spill use this transfer layer automatically
Encrypted stream bodies still require transformation staging because their bytes and length change before serialisation