|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.pdfbox.pdfparser.BaseParser
public abstract class BaseParser
This class is used to contain parsing logic that will be used by both the PDFParser and the COSStreamParser.
Field Summary | |
---|---|
static java.lang.String |
DEF
This is a byte array that will be used for comparisons. |
static byte[] |
ENDSTREAM
This is a byte array that will be used for comparisons. |
protected PushBackInputStream |
pdfSource
This is the stream that will be read from. |
Constructor Summary | |
---|---|
protected |
BaseParser(byte[] input)
Constructor. |
|
BaseParser(java.io.InputStream input)
Constructor. |
Method Summary | |
---|---|
void |
addXref(PDFXref xref)
This will add an xref. |
java.util.List |
getXrefs()
This will get all of the xrefs. |
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 COSBase |
parseDirObject()
This will parse a directory object from the stream. |
protected java.lang.String |
readExpectedString(java.lang.String theString)
This will read bytes until the end of line marker occurs. |
protected int |
readInt()
This will read an integer from the stream. |
protected java.lang.String |
readLine()
This will read bytes until the end of line marker occurs. |
protected java.lang.String |
readString()
This will read the next string from the stream. |
protected java.lang.String |
readString(int length)
This will read the next string from the stream up to a certain length. |
void |
setDocument(COSDocument doc)
Set the document for this stream. |
protected void |
skipSpaces()
This will skip all spaces and comments that are present. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte[] ENDSTREAM
public static final java.lang.String DEF
protected PushBackInputStream pdfSource
Constructor Detail |
---|
public BaseParser(java.io.InputStream input) throws java.io.IOException
input
- The input stream to read the data from.
java.io.IOException
- If there is an error reading the input stream.protected BaseParser(byte[] input) throws java.io.IOException
input
- The array to read the data from.
java.io.IOException
- If there is an error reading the byte data.Method Detail |
---|
public void setDocument(COSDocument doc)
doc
- The current document.protected COSDictionary parseCOSDictionary() throws java.io.IOException
java.io.IOException
- IF there is an error reading the stream.protected COSStream parseCOSStream(COSDictionary dic, RandomAccess file) throws java.io.IOException
file
- The file to write the stream to when reading.dic
- The dictionary that goes with this stream.
java.io.IOException
- If there is an error reading the stream.protected COSString parseCOSString() throws java.io.IOException
java.io.IOException
- If there is an error reading from the stream.protected COSArray parseCOSArray() throws java.io.IOException
java.io.IOException
- If there is an error parsing the stream.protected boolean isEndOfName(char ch)
ch
- The character
true
if the character terminates a PDF name, otherwise false
.protected COSName parseCOSName() throws java.io.IOException
java.io.IOException
- If there is an error reading from the stream.protected COSBoolean parseBoolean() throws java.io.IOException
java.io.IOException
- If an IO error occurs during parsing.protected COSBase parseDirObject() throws java.io.IOException
java.io.IOException
- If there is an error during parsing.protected java.lang.String readString() throws java.io.IOException
java.io.IOException
- If there is an error reading from the stream.protected java.lang.String readExpectedString(java.lang.String theString) throws java.io.IOException
theString
- The next expected string in the stream.
java.io.IOException
- If there is an error reading from the stream or theString does not match what was read.protected java.lang.String readString(int length) throws java.io.IOException
length
- The length to stop reading at.
java.io.IOException
- If there is an error reading from the stream.protected boolean isClosing() throws java.io.IOException
java.io.IOException
- If an IO error occurs.protected boolean isClosing(int c)
c
- The character to check against end of line
protected java.lang.String readLine() throws java.io.IOException
java.io.IOException
- If there is an error reading from the stream.protected boolean isEOL() throws java.io.IOException
java.io.IOException
- If there is an error reading from the stream.protected boolean isEOL(int c)
c
- The character to check against end of line
protected boolean isWhitespace() throws java.io.IOException
java.io.IOException
- If there is an error reading from the stream.protected boolean isWhitespace(int c)
c
- The character to check against whitespace
protected void skipSpaces() throws java.io.IOException
java.io.IOException
- If there is an error reading from the stream.protected int readInt() throws java.io.IOException
java.io.IOException
- If there is an error reading from the stream.public void addXref(PDFXref xref)
xref
- The xref to add.public java.util.List getXrefs()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |