Package org.apache.pdfbox.pdfparser
Class PDFXrefStreamParser
- java.lang.Object
-
- org.apache.pdfbox.pdfparser.BaseParser
-
- org.apache.pdfbox.pdfparser.PDFXrefStreamParser
-
public class PDFXrefStreamParser extends BaseParser
This will parse a PDF 1.5 (or better) Xref stream and extract the xref information from the stream.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
PDFXrefStreamParser.ObjectNumbers
-
Field Summary
Fields Modifier and Type Field Description private PDFXrefStreamParser.ObjectNumbers
objectNumbers
private int[]
w
private XrefTrailerResolver
xrefTrailerResolver
-
Fields inherited from class org.apache.pdfbox.pdfparser.BaseParser
A, ASCII_CR, ASCII_LF, B, D, DEF, document, E, ENDOBJ_STRING, ENDSTREAM_STRING, J, M, MAX_LENGTH_LONG, N, O, R, S, seqSource, STREAM_STRING, T
-
-
Constructor Summary
Constructors Constructor Description PDFXrefStreamParser(COSStream stream, COSDocument document, XrefTrailerResolver resolver)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
close()
private void
initParserValues(COSStream stream)
void
parse()
Parses through the unfiltered stream and populates the xrefTable HashMap.private long
parseValue(byte[] data, int start, int length)
-
Methods inherited from class org.apache.pdfbox.pdfparser.BaseParser
isClosing, isClosing, isDigit, isDigit, isEndOfName, isEOL, isEOL, isSpace, isSpace, isWhitespace, isWhitespace, parseBoolean, parseCOSArray, parseCOSDictionary, parseCOSName, parseCOSString, parseDirObject, readExpectedChar, readExpectedString, readExpectedString, readGenerationNumber, readInt, readLine, readLong, readObjectNumber, readString, readString, readStringNumber, skipSpaces, skipWhiteSpaces
-
-
-
-
Field Detail
-
xrefTrailerResolver
private final XrefTrailerResolver xrefTrailerResolver
-
w
private final int[] w
-
objectNumbers
private PDFXrefStreamParser.ObjectNumbers objectNumbers
-
-
Constructor Detail
-
PDFXrefStreamParser
public PDFXrefStreamParser(COSStream stream, COSDocument document, XrefTrailerResolver resolver) throws java.io.IOException
Constructor.- Parameters:
stream
- The stream to parse.document
- The document for the current parsing.resolver
- resolver to read the xref/trailer information- Throws:
java.io.IOException
- If there is an error initializing the stream.
-
-
Method Detail
-
initParserValues
private void initParserValues(COSStream stream) throws java.io.IOException
- Throws:
java.io.IOException
-
close
private void close() throws java.io.IOException
- Throws:
java.io.IOException
-
parse
public void parse() throws java.io.IOException
Parses through the unfiltered stream and populates the xrefTable HashMap.- Throws:
java.io.IOException
- If there is an error while parsing the stream.
-
parseValue
private long parseValue(byte[] data, int start, int length)
-
-