This class is used to contain parsing logic that will be used by both the
PDFParser and the COSStreamParser.
addXref
public void addXref(PDFXref xref)
This will add an xref.
getXrefs
public List getXrefs()
This will get all of the xrefs.
isClosing
protected boolean isClosing()
throws IOException
This will tell if the next character is a closing brace( close of PDF array ).
- true if the next byte is ']', false otherwise.
isClosing
protected boolean isClosing(int c)
This will tell if the next character is a closing brace( close of PDF array ).
c
- The character to check against end of line
- true if the next byte is ']', false otherwise.
isEOL
protected boolean isEOL()
throws IOException
This will tell if the next byte to be read is an end of line byte.
- true if the next byte is 0x0A or 0x0D.
isEOL
protected boolean isEOL(int c)
This will tell if the next byte to be read is an end of line byte.
c
- The character to check against end of line
- true if the next byte is 0x0A or 0x0D.
isEndOfName
protected boolean isEndOfName(char ch)
Determine if a character terminates a PDF name.
true
if the character terminates a PDF name, otherwise false
.
isWhitespace
protected boolean isWhitespace()
throws IOException
This will tell if the next byte is whitespace or not.
- true if the next byte in the stream is a whitespace character.
isWhitespace
protected boolean isWhitespace(int c)
This will tell if the next byte is whitespace or not.
c
- The character to check against whitespace
- true if the next byte in the stream is a whitespace character.
parseBoolean
protected COSBoolean parseBoolean()
throws IOException
This will parse a boolean object from the stream.
- The parsed boolean object.
parseCOSArray
protected COSArray parseCOSArray()
throws IOException
This will parse a PDF array object.
parseCOSDictionary
protected COSDictionary parseCOSDictionary()
throws IOException
This will parse a PDF dictionary.
parseCOSName
protected COSName parseCOSName()
throws IOException
This will parse a PDF name from the stream.
parseCOSStream
protected COSStream parseCOSStream(COSDictionary dic,
RandomAccess file)
throws IOException
This will read a COSStream from the input stream.
dic
- The dictionary that goes with this stream.file
- The file to write the stream to when reading.
parseCOSString
protected COSString parseCOSString()
throws IOException
This will parse a PDF string.
parseDirObject
protected COSBase parseDirObject()
throws IOException
This will parse a directory object from the stream.
readExpectedString
protected String readExpectedString(String theString)
throws IOException
This will read bytes until the end of line marker occurs.
theString
- The next expected string in the stream.
- The characters between the current position and the end of the line.
readInt
protected int readInt()
throws IOException
This will read an integer from the stream.
- The integer that was read from the stream.
readLine
protected String readLine()
throws IOException
This will read bytes until the end of line marker occurs.
- The characters between the current position and the end of the line.
readString
protected String readString()
throws IOException
This will read the next string from the stream.
- The string that was read from the stream.
readString
protected String readString(int length)
throws IOException
This will read the next string from the stream up to a certain length.
length
- The length to stop reading at.
- The string that was read from the stream of length 0 to length.
setDocument
public void setDocument(COSDocument doc)
Set the document for this stream.
doc
- The current document.
skipSpaces
protected void skipSpaces()
throws IOException
This will skip all spaces and comments that are present.