Class COSPath


  • public final class COSPath
    extends java.lang.Object
    A parsed COS path: a starting point (the document trailer, or an explicit indirect object) plus a list of navigation steps.

    Syntax

       path      := root ("/" step | index-brackets)*
       root      := "trailer" | "root" | "catalog" | objref | /-- (empty, defaults to trailer)
       step      := name | integer | objref
       name      := any run of characters other than '/' and '[',
                    with '\/' and '\\' as escapes and '#xx' as a hex escape
                    (same convention as PDF name objects)
       index-brackets := "[" integer "]"
       objref    := integer WS+ integer WS+ "R"
     

    root and catalog are both shorthand for trailer/Root. A leading / is optional -- "/Root/Pages" and "Root/Pages" are equivalent, and both start from the trailer. Examples:

       /Root/Pages/Kids[0]/Contents
       root/Pages/Kids/0/MediaBox        (bare-integer array index, no brackets needed)
       catalog/Outlines/First/Title
       12 0 R/Filter                     (start from an explicit indirect object)
       trailer/Info
     

    Build one with COSPathParser.parse(String) (or the parse(String) shortcut here), then resolve it against a document with COSPathEvaluator.