org.icepdf.core.util
Class Parser

java.lang.Object
  extended by org.icepdf.core.util.Parser

public class Parser
extends java.lang.Object

put your documentation comment here


Field Summary
static int PARSE_MODE_NORMAL
           
static int PARSE_MODE_OBJECT_STREAM
           
 
Constructor Summary
Parser(java.io.InputStream r)
           
Parser(java.io.InputStream r, int pm)
           
Parser(SeekableInput r)
           
Parser(SeekableInput r, int pm)
           
 
Method Summary
 PObject addPObject(Library library, Reference objectReference)
          Utility Method for getting a PObject from the stack and adding it to the library.
 char getCharSurroundedByWhitespace()
           
 int getIntSurroundedByWhitespace()
           
 int getLinearTraversalOffset()
           
 long getLongSurroundedByWhitespace()
           
 java.lang.Number getNumber(java.lang.StringBuilder value)
           
 java.lang.Object getNumberOrStringWithMark(int maxLength)
           
 java.lang.Object getObject(Library library)
          Get an object from the pdf input DataInputStream.
 java.lang.Object getStreamObject()
          Returns the next object found in a content stream.
 java.lang.Object getToken()
          Utility method used to parse a valid pdf token from an DataIinputStream.
static boolean isWhitespace(char c)
          White space characters defined by ' ', '\t', '\r', '\n', '\f'
 java.lang.String peek2()
           
 boolean readLineForInlineImage(java.io.OutputStream out)
           
 void ungetNumberOrStringWithReset()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARSE_MODE_NORMAL

public static final int PARSE_MODE_NORMAL
See Also:
Constant Field Values

PARSE_MODE_OBJECT_STREAM

public static final int PARSE_MODE_OBJECT_STREAM
See Also:
Constant Field Values
Constructor Detail

Parser

public Parser(SeekableInput r)

Parser

public Parser(SeekableInput r,
              int pm)

Parser

public Parser(java.io.InputStream r)

Parser

public Parser(java.io.InputStream r,
              int pm)
Method Detail

getObject

public java.lang.Object getObject(Library library)
                           throws PDFException
Get an object from the pdf input DataInputStream.

Parameters:
library - all found objects in the pdf document
Returns:
the next object in the DataInputStream. Null is returned if there are no more objects left in the DataInputStream or a I/O error is encountered.
Throws:
PDFException - error getting object from library

peek2

public java.lang.String peek2()
                       throws java.io.IOException
Returns:
Throws:
java.io.IOException

readLineForInlineImage

public boolean readLineForInlineImage(java.io.OutputStream out)
                               throws java.io.IOException
Returns:
true if ate the ending EI delimiter
Throws:
java.io.IOException

addPObject

public PObject addPObject(Library library,
                          Reference objectReference)
Utility Method for getting a PObject from the stack and adding it to the library. The retrieved PObject has an ObjectReference added to it for decryption purposes.

Parameters:
library - HashMap of all objects in document
objectReference - PObjet indirect reference data
Returns:
a valid PObject.

getStreamObject

public java.lang.Object getStreamObject()
                                 throws java.io.IOException
Returns the next object found in a content stream.

Returns:
next object in the input stream
Throws:
java.io.IOException - when the end of the InputStream has been encountered.

getToken

public java.lang.Object getToken()
                          throws java.io.IOException
Utility method used to parse a valid pdf token from an DataIinputStream. Each call to this method return one pdf token. The Reader object is used to "mark" the location of the last "read".

Returns:
the next token in the pdf data stream
Throws:
java.io.IOException - if an I/O error occurs.

getNumberOrStringWithMark

public java.lang.Object getNumberOrStringWithMark(int maxLength)
                                           throws java.io.IOException
Throws:
java.io.IOException

ungetNumberOrStringWithReset

public void ungetNumberOrStringWithReset()
                                  throws java.io.IOException
Throws:
java.io.IOException

getIntSurroundedByWhitespace

public int getIntSurroundedByWhitespace()

getNumber

public java.lang.Number getNumber(java.lang.StringBuilder value)

getLongSurroundedByWhitespace

public long getLongSurroundedByWhitespace()

getLinearTraversalOffset

public int getLinearTraversalOffset()

getCharSurroundedByWhitespace

public char getCharSurroundedByWhitespace()

isWhitespace

public static boolean isWhitespace(char c)
White space characters defined by ' ', '\t', '\r', '\n', '\f'

Parameters:
c - true if character is white space