public abstract class BaseParser extends Object
| Modifier and Type | Field and Description | 
|---|---|
| static String | DEFThis is a string constant that will be used for comparisons. | 
| protected COSDocument | documentThis is the document that will be parsed. | 
| static byte[] | ENDOBJThis is a byte array that will be used for comparisons. | 
| static byte[] | ENDSTREAMThis is a byte array that will be used for comparisons. | 
| protected boolean | forceParsingFlag to skip malformed or otherwise unparseable input where possible. | 
| protected PushBackInputStream | pdfSourceThis is the stream that will be read from. | 
| static String | PROP_PUSHBACK_SIZEsystem property allowing to define size of push back buffer. | 
| Modifier | Constructor and Description | 
|---|---|
|   | BaseParser()Default constructor. | 
| protected  | BaseParser(byte[] input)Constructor. | 
|   | BaseParser(InputStream input)Constructor. | 
|   | BaseParser(InputStream input,
          boolean forceParsingValue)Constructor. | 
| Modifier and Type | Method and Description | 
|---|---|
| void | clearResources()Release all used resources. | 
| protected boolean | isClosing()This will tell if the next character is a closing brace( close of PDF array ). | 
| protected boolean | isClosing(int c)This will tell if the next character is a closing brace( close of PDF array ). | 
| protected boolean | isEndOfName(char ch)Determine if a character terminates a PDF name. | 
| protected boolean | isEOL()This will tell if the next byte to be read is an end of line byte. | 
| protected boolean | isEOL(int c)This will tell if the next byte to be read is an end of line byte. | 
| protected boolean | isWhitespace()This will tell if the next byte is whitespace or not. | 
| protected boolean | isWhitespace(int c)This will tell if the next byte is whitespace or not. | 
| protected COSBoolean | parseBoolean()This will parse a boolean object from the stream. | 
| protected COSArray | parseCOSArray()This will parse a PDF array object. | 
| protected COSDictionary | parseCOSDictionary()This will parse a PDF dictionary. | 
| protected COSName | parseCOSName()This will parse a PDF name from the stream. | 
| protected COSStream | parseCOSStream(COSDictionary dic,
              RandomAccess file)This will read a COSStream from the input stream. | 
| protected COSString | parseCOSString()This will parse a PDF string. | 
| protected COSString | parseCOSString(boolean isDictionary)Deprecated. 
 Not needed anymore. Use  parseCOSString()instead. PDFBOX-1437 | 
| protected COSBase | parseDirObject()This will parse a directory object from the stream. | 
| protected String | readExpectedString(String theString)This will read bytes until the end of line marker occurs. | 
| protected int | readGenerationNumber()This will read a integer from the Stream and throw an  IllegalArgumentExceptionif the integer value
 has more than the maximum object revision (i.e. : bigger thanGENERATION_NUMBER_THRESHOLD) | 
| protected int | readInt()This will read an integer from the stream. | 
| protected String | readLine()This will read bytes until the first end of line marker occurs. | 
| protected long | readLong()This will read an long from the stream. | 
| protected long | readObjectNumber()This will read a long from the Stream and throw an  IllegalArgumentExceptionif the long value
 has more than 10 digits (i.e. : bigger thanOBJECT_NUMBER_THRESHOLD) | 
| protected String | readString()This will read the next string from the stream. | 
| protected String | readString(int length)This will read the next string from the stream up to a certain length. | 
| protected StringBuilder | readStringNumber()This method is used to read a token by the readInt() method
 and the readLong() method. | 
| protected void | readUntilEndStream(OutputStream out)This method will read through the current stream object until
 we find the keyword "endstream" meaning we're at the end of this
 object. | 
| void | setDocument(COSDocument doc)Set the document for this stream. | 
| protected void | skipSpaces()This will skip all spaces and comments that are present. | 
public static final String PROP_PUSHBACK_SIZE
public static final byte[] ENDSTREAM
public static final byte[] ENDOBJ
public static final String DEF
protected PushBackInputStream pdfSource
protected COSDocument document
protected final boolean forceParsing
public BaseParser()
public BaseParser(InputStream input, boolean forceParsingValue) throws IOException
input - The input stream to read the data from.forceParsingValue - flag to skip malformed or otherwise unparseable
                     input where possibleIOException - If there is an error reading the input stream.public BaseParser(InputStream input) throws IOException
input - The input stream to read the data from.IOException - If there is an error reading the input stream.protected BaseParser(byte[] input)
              throws IOException
input - The array to read the data from.IOException - If there is an error reading the byte data.public void setDocument(COSDocument doc)
doc - The current document.protected COSDictionary parseCOSDictionary() throws IOException
IOException - IF there is an error reading the stream.protected COSStream parseCOSStream(COSDictionary dic, RandomAccess file) throws IOException
file - The file to write the stream to when reading.dic - The dictionary that goes with this stream.IOException - If there is an error reading the stream.protected void readUntilEndStream(OutputStream out) throws IOException
out - stream we write out to.IOException@Deprecated protected COSString parseCOSString(boolean isDictionary) throws IOException
parseCOSString() instead. PDFBOX-1437isDictionary - indicates if the stream is a dictionary or notIOException - If there is an error reading from the stream.protected COSString parseCOSString() throws IOException
IOException - If there is an error reading from the stream.protected COSArray parseCOSArray() throws IOException
IOException - If there is an error parsing the stream.protected boolean isEndOfName(char ch)
ch - The charactertrue if the character terminates a PDF name, otherwise false.protected COSName parseCOSName() throws IOException
IOException - If there is an error reading from the stream.protected COSBoolean parseBoolean() throws IOException
IOException - If an IO error occurs during parsing.protected COSBase parseDirObject() throws IOException
IOException - If there is an error during parsing.protected String readString() throws IOException
IOException - If there is an error reading from the stream.protected String readExpectedString(String theString) throws IOException
theString - The next expected string in the stream.IOException - If there is an error reading from the stream or theString does not match what was read.protected String readString(int length) throws IOException
length - The length to stop reading at.IOException - If there is an error reading from the stream.protected boolean isClosing()
                     throws IOException
IOException - If an IO error occurs.protected boolean isClosing(int c)
c - The character to check against end of lineprotected String readLine() throws IOException
IOException - If there is an error reading from the stream.protected boolean isEOL()
                 throws IOException
IOException - If there is an error reading from the stream.protected boolean isEOL(int c)
c - The character to check against end of lineprotected boolean isWhitespace()
                        throws IOException
IOException - If there is an error reading from the stream.protected boolean isWhitespace(int c)
c - The character to check against whitespaceprotected void skipSpaces()
                   throws IOException
IOException - If there is an error reading from the stream.protected long readObjectNumber()
                         throws IOException
IllegalArgumentException if the long value
 has more than 10 digits (i.e. : bigger than OBJECT_NUMBER_THRESHOLD)IOException - if an I/O error occursprotected int readGenerationNumber()
                            throws IOException
IllegalArgumentException if the integer value
 has more than the maximum object revision (i.e. : bigger than GENERATION_NUMBER_THRESHOLD)IOException - if an I/O error occursprotected int readInt()
               throws IOException
IOException - If there is an error reading from the stream.protected long readLong()
                 throws IOException
IOException - If there is an error reading from the stream.protected final StringBuilder readStringNumber() throws IOException
IOException - throws by the pdfSource methods.public void clearResources()
Copyright © 2002–2016 The Apache Software Foundation. All rights reserved.