BuildLinearizedURLAccessPlan
Document management, performance
Description
Fetches the leading bytes of a byte-range source and returns a JSON plan describing how a client can paint page 1 while reading as little as possible
For a linearised document the plan reports the first-page section and merges the hint stream span; otherwise the range list carries the hint stream span alone when the head declares one
Syntax
Delphi
Function BuildLinearizedURLAccessPlan(Source: IPLByteRangeSource;
Out Report: WideString): Boolean;Parameters
| Source | The byte-range transport to probe; Nil returns {"error":"no-source"} |
|---|---|
| Report | Receives the JSON plan on success or a single-key error object on failure |
Return values
| True | A plan was produced; Report holds the JSON object |
|---|---|
| False | The source is missing, its total size is unknown or the leading read failed; Report describes the failure |
Remarks
The probe requests 8192 leading bytes; a shorter result is accepted and analysed as-is
The plan object carries totalBytes, rangeSupported, isLinearized, pageCount, firstPageObject, firstPageSectionEnd, hintStreamOffset, hintStreamLength, mainXRefOffset and firstPageRanges; each range entry is {"start":N,"end":M} with an inclusive end
Linearisation is accepted only when the /Linearized dictionary is present and its /L value equals the source's total length; a mismatch reports isLinearized as false
A missing size reports {"error":"size-unknown"} and a failed or empty leading read reports {"error":"head-read-failed"}
See also
IPLByteRangeSource, IPLByteRangeAvailabilitySource, LoadFromRangeSource, SetRangeSourceCacheLimit, TByteRangeStreamReadAt