java.lang.Object
org.sejda.sambox.input.XrefParser
Component responsible for finding and parsing the xref chain (either tables and streams). In case
of errors while parsing the xref chain (Ex. invalid offset, bad dictionaries etc) it has a
fallback mechanism performing a document full scan searching for xrefs. When parsing the
document, xref info are passed to the
COSParser which will use them to retrieve COS
objects on demand.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intHow many trailing bytes to read for EOF marker.private static final org.slf4j.Loggerprivate COSParserprivate static final Stringprivate FileTrailerprivate AbstractXrefStreamParserprivate AbstractXrefTableParser -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate booleandoParseXref(long xrefOffset) private longLooks for the startxref keyword within the latestDEFAULT_TRAIL_BYTECOUNTbytes of the source.private booleanisValidXrefOffset(long xrefOffset) private booleanisValidXrefStreamOffset(long xrefStreamOffset) voidparse()parse the xref using the given parser.private booleanparseXref(long xrefOffset) trailer()
-
Field Details
-
LOG
private static final org.slf4j.Logger LOG -
DEFAULT_TRAIL_BYTECOUNT
private static final int DEFAULT_TRAIL_BYTECOUNTHow many trailing bytes to read for EOF marker.- See Also:
-
STARTXREF
- See Also:
-
trailer
-
xrefStreamParser
-
xrefTableParser
-
parser
-
catalogSeenOffsets
-
-
Constructor Details
-
XrefParser
-
-
Method Details
-
parse
parse the xref using the given parser.- Throws:
IOException
-
findXrefOffset
Looks for the startxref keyword within the latestDEFAULT_TRAIL_BYTECOUNTbytes of the source. If found it returns the Long read after the keyword, if not it returns -1.- Returns:
- the xref offset or -1 if the startxref keyword is not found
- Throws:
IOException- If something went wrong.
-
parseXref
private boolean parseXref(long xrefOffset) -
doParseXref
- Throws:
IOException
-
isValidXrefOffset
- Parameters:
xrefOffset-- Returns:
- true if the given offset points to an xref table or and xref stream
- Throws:
IOException
-
isValidXrefStreamOffset
- Parameters:
xrefStreamOffset-- Returns:
- true if the given offset points to a valid xref stream
- Throws:
IOException
-
trailer
-