IncrementalUpdate
in package
Revises a document by appending new and changed objects to it, leaving its original bytes untouched.
The appended section has its own cross-reference table, or stream when the document's newest section is
one, and a trailer whose /Prev points to the section before. Everything the document already held, from
forms to earlier digital signatures, survives as an older revision.
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- add() : Reference
- Adds a new object.
- replace() : void
- Replaces an existing object with a new revision of it.
- toString() : string
- The document with the update appended.
- runs() : array<int, array{0: int, 1: int}>
- Groups sorted object numbers into runs of consecutive numbers.
- withStream() : string
- Appends a cross-reference stream, which lists itself among the objects.
- withTable() : string
- Appends a cross-reference table and trailer.
Properties
$document read-only
private
Document
$document
$next
private
int
$next
$objects
private
array<int, array{0: int, 1: mixed}>
$objects
= []
Object number => generation and value.
Methods
__construct()
public
__construct(Document $document) : mixed
Parameters
- $document : Document
-
The document to revise.
add()
Adds a new object.
public
add(mixed $value) : Reference
Parameters
- $value : mixed
-
The object's value.
Return values
Reference —A reference to it.
replace()
Replaces an existing object with a new revision of it.
public
replace(Reference $reference, mixed $value) : void
Parameters
- $reference : Reference
-
The object.
- $value : mixed
-
Its new value.
toString()
The document with the update appended.
public
toString() : string
Return values
stringruns()
Groups sorted object numbers into runs of consecutive numbers.
private
static runs(array<int, int> $numbers) : array<int, array{0: int, 1: int}>
Parameters
- $numbers : array<int, int>
-
Sorted object numbers.
Return values
array<int, array{0: int, 1: int}> —Each run's first number and length.
withStream()
Appends a cross-reference stream, which lists itself among the objects.
private
withStream(string $out, array<int, array{0: int, 1: int}> $offsets, Dictionary $trailer) : string
Parameters
- $out : string
-
The document so far.
- $offsets : array<int, array{0: int, 1: int}>
-
Object number => offset and generation.
- $trailer : Dictionary
-
The trailer, without
/Size.
Return values
stringwithTable()
Appends a cross-reference table and trailer.
private
withTable(string $out, array<int, array{0: int, 1: int}> $offsets, Dictionary $trailer) : string
Parameters
- $out : string
-
The document so far.
- $offsets : array<int, array{0: int, 1: int}>
-
Object number => offset and generation.
- $trailer : Dictionary
-
The trailer, without
/Size.