public abstract class BaseParser extends Object
Modifier and Type | Field and Description |
---|---|
protected static int |
A |
protected static byte |
ASCII_CR
ASCII code for carriage return.
|
protected static byte |
ASCII_LF
ASCII code for line feed.
|
protected static int |
B |
protected static int |
D |
static String |
DEF
This is a string constant that will be used for comparisons.
|
protected COSDocument |
document
This is the document that will be parsed.
|
protected static int |
E |
protected static String |
ENDOBJ_STRING
This is a string constant that will be used for comparisons.
|
protected static String |
ENDSTREAM_STRING
This is a string constant that will be used for comparisons.
|
protected static int |
J |
protected static int |
M |
protected static int |
N |
protected static int |
O |
protected static int |
R |
protected static int |
S |
protected org.apache.pdfbox.pdfparser.SequentialSource |
seqSource
This is the stream that will be read from.
|
protected static String |
STREAM_STRING
This is a string constant that will be used for comparisons.
|
protected static int |
T |
Constructor and Description |
---|
BaseParser(org.apache.pdfbox.pdfparser.SequentialSource pdfSource)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
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 |
isDigit()
This will tell if the next byte is a digit or not.
|
protected static boolean |
isDigit(int c)
This will tell if the given value is a digit or not.
|
protected boolean |
isEndOfName(int 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 |
isSpace()
This will tell if the next byte is a space or not.
|
protected boolean |
isSpace(int c)
This will tell if the given value is a space or not.
|
protected boolean |
isWhitespace()
This will tell if the next byte is whitespace or not.
|
protected boolean |
isWhitespace(int c)
This will tell if a character 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 COSString |
parseCOSString()
This will parse a PDF string.
|
protected COSBase |
parseDirObject()
This will parse a directory object from the stream.
|
protected void |
readExpectedChar(char ec)
Read one char and throw an exception if it is not the expected value.
|
protected void |
readExpectedString(char[] expectedString,
boolean skipSpaces)
Reads given pattern from
seqSource . |
protected void |
readExpectedString(String expectedString)
Read one String and throw an exception if it is not the expected value.
|
protected int |
readGenerationNumber()
This will read a integer from the Stream and throw an
IllegalArgumentException if the integer value
has more than the maximum object revision (i.e. : bigger than GENERATION_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
IOException if
the long value is negative or has more than 10 digits (i.e. : bigger than
OBJECT_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 |
skipSpaces()
This will skip all spaces and comments that are present.
|
protected void |
skipWhiteSpaces() |
protected static final int E
protected static final int N
protected static final int D
protected static final int S
protected static final int T
protected static final int R
protected static final int A
protected static final int M
protected static final int O
protected static final int B
protected static final int J
public static final String DEF
protected static final String ENDOBJ_STRING
protected static final String ENDSTREAM_STRING
protected static final String STREAM_STRING
protected static final byte ASCII_LF
protected static final byte ASCII_CR
protected final org.apache.pdfbox.pdfparser.SequentialSource seqSource
protected COSDocument document
public BaseParser(org.apache.pdfbox.pdfparser.SequentialSource pdfSource)
protected COSDictionary parseCOSDictionary() throws IOException
IOException
- If there is an error reading the stream.protected void skipWhiteSpaces() throws IOException
IOException
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(int ch)
ch
- The characterprotected 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 void readExpectedString(String expectedString) throws IOException
expectedString
- the String value that is expected.IOException
- if the String char is not the expected value or if an
I/O error occurs.protected final void readExpectedString(char[] expectedString, boolean skipSpaces) throws IOException
seqSource
. Skipping whitespace at start and end if wanted.expectedString
- pattern to be skippedskipSpaces
- if set to true spaces before and after the string will be skippedIOException
- if pattern could not be readprotected void readExpectedChar(char ec) throws IOException
ec
- the char value that is expected.IOException
- if the read char is not the expected value or if an
I/O error occurs.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 boolean isSpace() throws IOException
IOException
- If there is an error reading from the stream.protected boolean isSpace(int c)
c
- The character to check against spaceprotected boolean isDigit() throws IOException
IOException
- If there is an error reading from the stream.protected static boolean isDigit(int c)
c
- The character to be checkedprotected void skipSpaces() throws IOException
IOException
- If there is an error reading from the stream.protected long readObjectNumber() throws IOException
IOException
if
the long value is negative or 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 seqSource
methods.Copyright © 2002–2017 The Apache Software Foundation. All rights reserved.