java.lang.Object | |
↳ | com.pdftron.sdf.NumberTree |
A NumberTree is a common data structure in PDF. See section 3.8.6 'Number Trees' in PDF Reference Manual for more details. A number tree serves a similar purpose to a dictionary - associating keys and values - but by different means. NumberTrees allow efficient storage of very large association collections (number/Obj* maps). A NumberTree can have many more entries than a SDF/Cos dictionary can. Sample code: PDFDoc doc = new PDFDoc("../Data/test.pdf"); NumberTree labels = doc.getRoot().get("PageLabels").value()); if (labels.isValid()) { // Traversing the NumberTree for (NumberTreeIterator i = labels.GetIterator(); i.HasNext(); i.Next()) num = i.Key().GetNumber(); }
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
NumberTree(Obj number_tree)
Create a high level NumberTree wrapper around an existing SDF/Cos NumberTree.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
erase(DictIterator pos)
Removes the NumberTree entry pointed by the iterator.
| ||||||||||
void |
erase(long key)
Removes the specified object from the tree.
| ||||||||||
DictIterator |
getIterator()
Get the iterator.
| ||||||||||
DictIterator |
getIterator(long key)
Search for the specified key in the NumberTree.
| ||||||||||
Obj |
getSDFObj()
Get the SDFObj.
| ||||||||||
Obj |
getValue(long key)
Get the value of the specified NumberTree.
| ||||||||||
boolean |
isValid()
Checks if NumberTree is valid.
| ||||||||||
void |
put(long key, Obj value)
Puts a new entry in the name tree.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Create a high level NumberTree wrapper around an existing SDF/Cos NumberTree. This does not copy the object.
number_tree | SDF/Cos root of the NumberTree object. |
---|
Removes the specified object from the tree. Does nothing if no object with that number exists.
key | A number representing the key of the entry to be removed. |
---|
PDFNetException |
---|
Get the iterator.
for (NumberTreeIterator i = dests.getIterator(); i.hasNext(); i.next())
num = i.GetKey().GetNumber();
PDFNetException |
---|
Search for the specified key in the NumberTree.
key | the number representing the key to be found.
NumberTreeIterator i = dests.find(5);
if (i.hasNext()) {
double key = i.getKey()->getNumber();
Obj value=i.getValue();
} |
---|
PDFNetException |
---|
Get the SDFObj.
Get the value of the specified NumberTree.
key | the key of the NumberTree |
---|
PDFNetException |
---|
Checks if NumberTree is valid.
PDFNetException |
---|
Puts a new entry in the name tree. If an entry with this number is already in the tree, it is replaced.
key | A number representing the key of the new entry. |
---|---|
value | the value |
PDFNetException |
---|