Package com.pd4ml.pdf.cos.path
Class COSPath
- java.lang.Object
-
- com.pd4ml.pdf.cos.path.COSPath
-
public final class COSPath extends java.lang.ObjectA 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"rootandcatalogare both shorthand fortrailer/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 theparse(String)shortcut here), then resolve it against a document withCOSPathEvaluator.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCOSPath.RootKindWhere a path's navigation starts.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description COSPath.RootKindgetRootKind()COSObjectKeygetRootRef()Non-null only whengetRootKind()isCOSPath.RootKind.OBJECT_REF.java.util.List<COSPathSegment>getSegments()static COSPathparse(java.lang.String expression)java.lang.StringtoString()
-
-
-
Method Detail
-
parse
public static COSPath parse(java.lang.String expression) throws COSPathException
- Throws:
COSPathException
-
getRootKind
public COSPath.RootKind getRootKind()
-
getRootRef
public COSObjectKey getRootRef()
Non-null only whengetRootKind()isCOSPath.RootKind.OBJECT_REF.
-
getSegments
public java.util.List<COSPathSegment> getSegments()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-