Package com.tom_roush.pdfbox.pdfparser
Class PDFStreamParser
- java.lang.Object
-
- com.tom_roush.pdfbox.pdfparser.BaseParser
-
- com.tom_roush.pdfbox.pdfparser.PDFStreamParser
-
public class PDFStreamParser extends BaseParser
This will parse a PDF byte stream and extract operands and such.
-
-
Field Summary
-
Fields inherited from class com.tom_roush.pdfbox.pdfparser.BaseParser
A, ASCII_CR, ASCII_LF, B, D, DEF, document, E, ENDOBJ_STRING, ENDSTREAM_STRING, J, M, N, O, R, S, seqSource, STREAM_STRING, T
-
-
Constructor Summary
Constructors Constructor Description PDFStreamParser(byte[] bytes)Constructor.PDFStreamParser(PDContentStream contentStream)Constructor.PDFStreamParser(COSStream stream)Deprecated.UsePDFStreamParser(PDContentStream)instead.PDFStreamParser(PDStream stream)Deprecated.UsePDFStreamParser(PDContentStream)instead.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Object>getTokens()This will get the tokens that were parsed from the stream.voidparse()This will parse the tokens in the stream.ObjectparseNextToken()This will parse the next token in the stream.protected StringreadOperator()This will read an operator from the stream.-
Methods inherited from class com.tom_roush.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, skipWhiteSpace
-
-
-
-
Constructor Detail
-
PDFStreamParser
@Deprecated public PDFStreamParser(PDStream stream) throws IOException
Deprecated.UsePDFStreamParser(PDContentStream)instead.Constructor.- Parameters:
stream- The stream to parse.- Throws:
IOException- If there is an error initializing the stream.
-
PDFStreamParser
@Deprecated public PDFStreamParser(COSStream stream) throws IOException
Deprecated.UsePDFStreamParser(PDContentStream)instead.Constructor.- Parameters:
stream- The stream to parse.- Throws:
IOException- If there is an error initializing the stream.
-
PDFStreamParser
public PDFStreamParser(PDContentStream contentStream) throws IOException
Constructor.- Parameters:
contentStream- The content stream to parse.- Throws:
IOException- If there is an error initializing the stream.
-
PDFStreamParser
public PDFStreamParser(byte[] bytes) throws IOExceptionConstructor.- Parameters:
bytes- the bytes to parse.- Throws:
IOException- If there is an error initializing the stream.
-
-
Method Detail
-
parse
public void parse() throws IOExceptionThis will parse the tokens in the stream. This will close the stream when it is finished parsing.- Throws:
IOException- If there is an error while parsing the stream.
-
getTokens
public List<Object> getTokens()
This will get the tokens that were parsed from the stream.- Returns:
- All of the tokens in the stream.
-
parseNextToken
public Object parseNextToken() throws IOException
This will parse the next token in the stream.- Returns:
- The next token in the stream or null if there are no more tokens in the stream.
- Throws:
IOException- If an io error occurs while parsing the stream.
-
readOperator
protected String readOperator() throws IOException
This will read an operator from the stream.- Returns:
- The operator that was read from the stream.
- Throws:
IOException- If there is an error reading from the stream.
-
-