org.pdfbox.pdfparser

Class PDFStreamParser


public class PDFStreamParser
extends BaseParser

This will parse a PDF byte stream and extract operands and such.
Version:
$Revision: 1.32 $
Author:
Ben Litchfield

Field Summary

Fields inherited from class org.pdfbox.pdfparser.BaseParser

DEF, ENDSTREAM, pdfSource

Constructor Summary

PDFStreamParser(InputStream stream, RandomAccess raf)
Constructor that takes a stream to parse.
PDFStreamParser(COSStream stream)
Constructor.
PDFStreamParser(PDStream stream)
Constructor.

Method Summary

List
getTokens()
This will get the tokens that were parsed from the stream.
void
parse()
This will parse the tokens in the stream.
protected String
readOperator()
This will read an operator from the stream.

Methods inherited from class org.pdfbox.pdfparser.BaseParser

addXref, getXrefs, isClosing, isClosing, isEOL, isEOL, isEndOfName, isWhitespace, isWhitespace, parseBoolean, parseCOSArray, parseCOSDictionary, parseCOSName, parseCOSStream, parseCOSString, parseDirObject, readExpectedString, readInt, readLine, readString, readString, setDocument, skipSpaces

Constructor Details

PDFStreamParser

public PDFStreamParser(InputStream stream,
                       RandomAccess raf)
            throws IOException
Constructor that takes a stream to parse.
Parameters:
stream - The stream to read data from.
raf - The random access file.

PDFStreamParser

public PDFStreamParser(COSStream stream)
            throws IOException
Constructor.
Parameters:
stream - The stream to parse.

PDFStreamParser

public PDFStreamParser(PDStream stream)
            throws IOException
Constructor.
Parameters:
stream - The stream to parse.

Method Details

getTokens

public List getTokens()
This will get the tokens that were parsed from the stream.
Returns:
All of the tokens in the stream.

parse

public void parse()
            throws IOException
This will parse the tokens in the stream. This will close the stream when it is finished parsing.

readOperator

protected String readOperator()
            throws IOException
This will read an operator from the stream.
Returns:
The operator that was read from the stream.