public class ConformingPDFParser extends BaseParser
Modifier and Type | Field | Description |
---|---|---|
protected RandomAccess |
inputFile |
DEF, document, ENDOBJ, ENDSTREAM, forceParsing, pdfSource, PROP_PUSHBACK_SIZE
Constructor | Description |
---|---|
ConformingPDFParser(java.io.File inputFile) |
Constructor.
|
Modifier and Type | Method | Description |
---|---|---|
protected byte |
consumeWhitespace() |
This will read all bytes until a non-whitespace character is
found.
|
protected byte |
consumeWhitespaceBackwards() |
This will read all bytes (backwards) until a non-whitespace character is
found.
|
COSDocument |
getDocument() |
This will get the document that was parsed.
|
COSBase |
getObject(long objectNumber,
long generation) |
|
PDDocument |
getPDDocument() |
This will get the PD document that was parsed.
|
boolean |
isRecursivlyRead() |
|
void |
parse() |
This will parse the stream and populate the COSDocument object.
|
protected COSNumber |
parseNumber(java.lang.String number) |
|
protected long |
parseTrailerInformation() |
|
protected COSBase |
processCosObject(java.lang.String string) |
|
protected java.lang.String |
readBackwardUntilWhitespace() |
|
protected byte |
readByte() |
|
protected byte |
readByteBackwards() |
|
protected COSDictionary |
readDictionaryBackwards() |
|
protected int |
readInt() |
This will read an integer from the stream.
|
protected java.lang.String |
readLine() |
This will read a line starting with the byte at offset and going
forward until it finds a newline.
|
protected java.lang.String |
readLineBackwards() |
This will read a line starting with the byte at offset and going
backwards until it finds a newline.
|
protected long |
readLongBackwards() |
This will consume any whitespace, read in bytes until whitespace is found
again and then parse the characters which have been read as a long.
|
protected COSName |
readNameBackwards() |
|
protected COSNumber |
readNumber() |
This will read in a number and return the COS version of the number (be
it a COSInteger or a COSFloat).
|
protected COSBase |
readObject() |
This actually reads the object data.
|
COSBase |
readObject(long objectNumber,
long generation) |
This will read an object from the inputFile at whatever our currentOffset
is.
|
protected COSBase |
readObjectBackwards() |
|
protected java.lang.String |
readString() |
This will read the next string from the stream.
|
protected java.lang.String |
readWord() |
|
void |
setRecursivlyRead(boolean recursivlyRead) |
clearResources, isClosing, isClosing, isEndOfName, isEOL, isEOL, isWhitespace, isWhitespace, parseBoolean, parseCOSArray, parseCOSDictionary, parseCOSName, parseCOSStream, parseCOSString, parseCOSString, parseDirObject, readExpectedString, readGenerationNumber, readLong, readObjectNumber, readString, readStringNumber, readUntilEndStream, setDocument, skipSpaces
protected RandomAccess inputFile
public ConformingPDFParser(java.io.File inputFile) throws java.io.IOException
inputFile
- The input stream that contains the PDF document.java.io.IOException
- If there is an error initializing the stream.public void parse() throws java.io.IOException
java.io.IOException
- If there is an error reading from the stream or corrupt data
is found.public COSDocument getDocument() throws java.io.IOException
java.io.IOException
- If there is an error getting the document.public PDDocument getPDDocument() throws java.io.IOException
java.io.IOException
- If there is an error getting the document.protected long parseTrailerInformation() throws java.io.IOException, java.lang.NumberFormatException
java.io.IOException
java.lang.NumberFormatException
protected byte readByteBackwards() throws java.io.IOException
java.io.IOException
protected byte readByte() throws java.io.IOException
java.io.IOException
protected java.lang.String readBackwardUntilWhitespace() throws java.io.IOException
java.io.IOException
protected byte consumeWhitespaceBackwards() throws java.io.IOException
java.io.IOException
- if there is an error reading from the fileprotected byte consumeWhitespace() throws java.io.IOException
java.io.IOException
- if there is an error reading from the fileprotected long readLongBackwards() throws java.io.IOException, java.lang.NumberFormatException
java.io.IOException
- if there is an error reading from the filejava.lang.NumberFormatException
- if the bytes read can not be converted to a numberprotected int readInt() throws java.io.IOException
BaseParser
readInt
in class BaseParser
java.io.IOException
- If there is an error reading from the stream.protected COSNumber readNumber() throws java.io.IOException
java.io.IOException
protected COSNumber parseNumber(java.lang.String number) throws java.io.IOException
java.io.IOException
protected COSBase processCosObject(java.lang.String string) throws java.io.IOException
java.io.IOException
protected COSBase readObjectBackwards() throws java.io.IOException
java.io.IOException
protected COSName readNameBackwards() throws java.io.IOException
java.io.IOException
public COSBase getObject(long objectNumber, long generation) throws java.io.IOException
java.io.IOException
public COSBase readObject(long objectNumber, long generation) throws java.io.IOException
objectNumber
- the object number you expect to readgeneration
- the generation you expect this object to bejava.io.IOException
protected COSBase readObject() throws java.io.IOException
java.io.IOException
protected java.lang.String readString() throws java.io.IOException
readString
in class BaseParser
java.io.IOException
- If there is an error reading from the stream.protected COSDictionary readDictionaryBackwards() throws java.io.IOException
java.io.IOException
protected java.lang.String readLineBackwards() throws java.io.IOException
java.io.IOException
- if there was an error reading data from the fileprotected java.lang.String readLine() throws java.io.IOException
readLine
in class BaseParser
java.io.IOException
- if there was an error reading data from the fileprotected java.lang.String readWord() throws java.io.IOException
java.io.IOException
public boolean isRecursivlyRead()
public void setRecursivlyRead(boolean recursivlyRead)
recursivlyRead
- the recursivlyRead to set