Package org.apache.pdfbox.pdfparser
Class PDFObjectStreamParser
java.lang.Object
org.apache.pdfbox.pdfparser.BaseParser
org.apache.pdfbox.pdfparser.PDFObjectStreamParser
This will parse a PDF 1.5 object stream and extract the object with given object number from the stream.
-
Field Summary
FieldsFields 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, source, STREAM_STRING, T -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionParse all compressed objects.parseObject(long objectNumber) Search for/parse the object with the given object number.Read all object numbers from the compressed object stream.Methods inherited from class org.apache.pdfbox.pdfparser.BaseParser
getObjectKey, isClosing, isClosing, isDigit, isDigit, isEndOfName, isEOF, isEOL, isEOL, isSpace, isSpace, isWhitespace, isWhitespace, parseCOSArray, parseCOSDictionary, parseCOSName, parseCOSString, parseDirObject, readExpectedChar, readExpectedString, readGenerationNumber, readInt, readLine, readLong, readObjectNumber, readString, readString, readStringNumber, skipSpaces, skipWhiteSpaces
-
Field Details
-
numberOfObjects
private final int numberOfObjects -
firstObject
private final int firstObject
-
-
Constructor Details
-
PDFObjectStreamParser
Constructor.- Parameters:
stream- The stream to parse.document- The document for the current parsing.- Throws:
IOException- If there is an error initializing the stream.
-
-
Method Details
-
parseObject
Search for/parse the object with the given object number. The stream is closed after parsing the object with the given number.- Parameters:
objectNumber- the number of the object to b e parsed- Returns:
- the parsed object or null if the object with the given number can't be found
- Throws:
IOException- if there is an error while parsing the stream
-
parseAllObjects
Parse all compressed objects. The stream is closed after parsing.- Returns:
- a map containing all parsed objects using the object number as key
- Throws:
IOException- if there is an error while parsing the stream
-
privateReadObjectNumbers
- Throws:
IOException
-
privateReadObjectOffsets
- Throws:
IOException
-
readObjectNumbers
Read all object numbers from the compressed object stream. The stream is closed after reading the object numbers.- Returns:
- a map off all object numbers and the corresponding offset within the object stream.
- Throws:
IOException- if there is an error while parsing the stream
-