Package org.apache.pdfbox.pdfparser
Class PDFObjectStreamParser
- java.lang.Object
-
- org.apache.pdfbox.pdfparser.BaseParser
-
- org.apache.pdfbox.pdfparser.PDFObjectStreamParser
-
public class PDFObjectStreamParser extends BaseParser
This will parse a PDF 1.5 object stream and extract all of the objects from the stream.
-
-
Field Summary
Fields Modifier and Type Field Description private int
firstObject
private static org.apache.commons.logging.Log
LOG
Log instance.private int
numberOfObjects
private java.util.List<COSObject>
streamObjects
-
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 PDFObjectStreamParser(COSStream stream, COSDocument document)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<COSObject>
getObjects()
This will get the objects that were parsed from the stream.void
parse()
This will parse the tokens in the stream.private COSBase
parseObject(int offset)
private java.util.Map<java.lang.Integer,java.lang.Long>
readOffsets()
-
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
-
LOG
private static final org.apache.commons.logging.Log LOG
Log instance.
-
streamObjects
private java.util.List<COSObject> streamObjects
-
numberOfObjects
private final int numberOfObjects
-
firstObject
private final int firstObject
-
-
Constructor Detail
-
PDFObjectStreamParser
public PDFObjectStreamParser(COSStream stream, COSDocument document) throws java.io.IOException
Constructor.- Parameters:
stream
- The stream to parse.document
- The document for the current parsing.- Throws:
java.io.IOException
- If there is an error initializing the stream.
-
-
Method Detail
-
parse
public void parse() throws java.io.IOException
This will parse the tokens in the stream. This will close the stream when it is finished parsing.- Throws:
java.io.IOException
- If there is an error while parsing the stream.
-
getObjects
public java.util.List<COSObject> getObjects()
This will get the objects that were parsed from the stream.- Returns:
- All of the objects in the stream.
-
readOffsets
private java.util.Map<java.lang.Integer,java.lang.Long> readOffsets() throws java.io.IOException
- Throws:
java.io.IOException
-
parseObject
private COSBase parseObject(int offset) throws java.io.IOException
- Throws:
java.io.IOException
-
-