Documentation
¶
Overview ¶
Package numtree implements PDF number trees.
Number trees serve a similar purpose to dictionaries, associating keys and values, but using integer keys instead of name objects. The keys are stored in sorted numerical order, and the data structure can represent an arbitrarily large collection of key-value pairs with efficient lookup without requiring the entire structure to be read from the PDF file.
This package provides two implementations:
- InMemory: loads the entire tree into memory for fast access
- FromFile: reads nodes on demand for memory-efficient access to large trees
The Write function creates balanced number trees using a streaming B-tree algorithm that processes entries incrementally with O(log n) memory usage.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrKeyNotFound = errors.New("key not found")
Functions ¶
func Size ¶ added in v0.7.0
Size returns the number of entries in the number tree, without reading the entire tree into memory.
Types ¶
type FromFile ¶ added in v0.7.0
type FromFile struct {
// contains filtered or unexported fields
}
FromFile represents a number tree that allows reading values from a PDF file without holding the entire tree in memory.
func ExtractFromFile ¶ added in v0.7.0
ExtractFromFile creates a new FromFile number tree that reads from a PDF document. If root is nil, it returns nil.
type InMemory ¶ added in v0.7.0
InMemory represents a number tree held entirely in memory.
func ExtractInMemory ¶ added in v0.7.0
ExtractInMemory reads a number tree from a PDF document into memory. If obj is nil, it returns nil.