Class NameTree


  • public class NameTree
    extends java.lang.Object
    A PDF name tree consists of three kinds of nodes:
    • The root node contains only a kids entry, pointing to many other objects
    • An intermediate node contains the limits of all the children in its subtree, and a kids entry for each child
    • A leaf node contains a set of name-to-object mappings in a dictionary, as well as the limits of the data contained in that child.
    A PDF name tree is sorted in accordance with the String.compareTo() method.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private PDFObject root
      the root object
    • Constructor Summary

      Constructors 
      Constructor Description
      NameTree​(PDFObject root)
      Creates a new instance of NameTree
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private PDFObject find​(PDFObject root, java.lang.String key)
      Recursively walk the name tree looking for a given value
      PDFObject find​(java.lang.String key)
      Find the PDF object corresponding to the given String in a name tree
      private PDFObject findInArray​(PDFObject[] array, java.lang.String key)
      Find an object in a (key,value) array.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • root

        private PDFObject root
        the root object
    • Constructor Detail

      • NameTree

        public NameTree​(PDFObject root)
        Creates a new instance of NameTree
    • Method Detail

      • find

        public PDFObject find​(java.lang.String key)
                       throws java.io.IOException
        Find the PDF object corresponding to the given String in a name tree
        Parameters:
        key - the key we are looking for in the name tree
        Returns:
        the object associated with str, if found, or null if not
        Throws:
        java.io.IOException
      • find

        private PDFObject find​(PDFObject root,
                               java.lang.String key)
                        throws java.io.IOException
        Recursively walk the name tree looking for a given value
        Throws:
        java.io.IOException
      • findInArray

        private PDFObject findInArray​(PDFObject[] array,
                                      java.lang.String key)
                               throws java.io.IOException
        Find an object in a (key,value) array. Do this by splitting in half repeatedly.
        Throws:
        java.io.IOException