|
intarsys PDF library API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.intarsys.pdf.parser.PDFParser
public abstract class PDFParser
An abstract superclass for our two flavours of PDF Parsers.
Constructor Summary | |
---|---|
PDFParser()
|
Method Summary | |
---|---|
IPDFParserExceptionHandler |
getExceptionHandler()
|
void |
handleError(COSLoadError error)
Handle an error if an exceptionHandler is set. |
void |
handleWarning(COSLoadWarning warning)
Handle a warning if an exceptionHandler is set. |
static boolean |
isDelimiter(int i)
evaluate to true if i is a PDF Delimiter char. |
static boolean |
isDigit(int i)
evaluate to true if i is a valid digit. |
static boolean |
isEOL(int i)
evaluate to true if i is a valid line terminator. |
static boolean |
isNumberStart(int i)
evaluate to true if i is a valid first char for a number token. |
static boolean |
isOctalDigit(int i)
evaluate to true if i is a valid octal digit. |
static boolean |
isTokenStart(int i)
evaluate to true if i is a valid string token start. |
static boolean |
isWhitespace(int i)
evaluate to true if i is a valid whitespace. |
Object |
parseElement(IRandomAccess input)
parse the basic elements from the current stream position. |
STDocType |
parseHeader(IRandomAccess input)
pdf header see PDF Reference v1.4, chapter 3.4.1 Header COSHEader ::= "%PDF-" version. |
int |
readInteger(IRandomAccess input,
boolean consumeSpaceAfter)
reads the next integer on input. consumes one trailing space if consumeSpaceAfter is set to true. |
void |
readSpaces(IRandomAccess input)
read all characters until EOF or non space char appears. the first non space char is pushed back so the next char read is the first non space char. |
byte[] |
readToken(IRandomAccess input)
read a single token. |
byte[] |
readToken(IRandomAccess input,
List messages)
derive of readToken, populates the messages list with non-fatal error messages |
void |
setExceptionHandler(IPDFParserExceptionHandler exceptionHandler)
|
static COSObject |
toCOSObject(byte[] data)
parse the given byte array to a valid COSObject. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static char CHAR_CR
public static char CHAR_LF
public static char CHAR_HT
public static char CHAR_BS
public static char CHAR_FF
public static final byte[] TOKEN_PDFHEADER
public static final byte[] TOKEN_FDFHEADER
public static final byte[] TOKEN_EOF
public static final byte[] TOKEN_obj
public static final byte[] TOKEN_endobj
public static final byte[] TOKEN_false
public static final byte[] TOKEN_true
public static final byte[] TOKEN_null
public static final byte[] TOKEN_startxref
public static final byte[] TOKEN_trailer
public static final byte[] TOKEN_xref
public static final byte[] TOKEN_stream
public static final byte[] TOKEN_s_tream
public static final byte[] TOKEN_endstream
public static final byte[] TOKEN_ndstream
public static final byte[] TOKEN_R
public static final String C_WARN_UNEVENHEX
public static final String C_WARN_ILLEGALHEX
public static final String C_WARN_STRINGTOLONG
public static final String C_WARN_NAMETOLONG
public static final String C_WARN_ARRAYSIZE
public static final String C_WARN_SINGLESPACE
public static final String C_WARN_SINGLEEOL
public static final String C_WARN_STREAMEOL
public static final String C_WARN_ENDSTREAMEOL
public static final String C_WARN_ENDSTREAMCORRUPT
public static final String C_WARN_STREAMEXTERNAL
public static final String C_WARN_STREAMLENGTH
public static final String C_WARN_SINGLESPACE_OBJ
public static final String C_WARN_SINGLEEOL_OBJ
public static final String C_WARN_ENDOBJ_MISSING
Constructor Detail |
---|
public PDFParser()
Method Detail |
---|
public static final boolean isDelimiter(int i)
See pdf spec delimiter characters.
i
- i a byte representation
public static final boolean isDigit(int i)
i
- i a byte representation
public static final boolean isEOL(int i)
i
- i a byte representation
public static final boolean isNumberStart(int i)
i
- i a byte representation
public static final boolean isOctalDigit(int i)
i
- i a byte representation
public static final boolean isTokenStart(int i)
i
- i a byte representation
public static final boolean isWhitespace(int i)
See pdf spec "white space characters"
i
- i a byte representation
public static COSObject toCOSObject(byte[] data) throws IOException, COSLoadException
data
- a byte array containing COS encoded objects
IOException
COSLoadException
public IPDFParserExceptionHandler getExceptionHandler()
public void handleError(COSLoadError error) throws COSLoadException
error
-
COSLoadException
public void handleWarning(COSLoadWarning warning) throws COSLoadException
warning
-
COSLoadException
public Object parseElement(IRandomAccess input) throws IOException, COSLoadException
see PDF Reference v1.4, chapter 3.2 Objects
COSObject ::= COSToken | COSBoolean | COSString | COSNumber | COSName | COSNull | COSArray | COSDictionary | COSStream
IOException
COSLoadException
public STDocType parseHeader(IRandomAccess input) throws IOException, COSLoadException
IOException
COSLoadException
public int readInteger(IRandomAccess input, boolean consumeSpaceAfter) throws IOException
input
- consumeSpaceAfter
-
IOException
public void readSpaces(IRandomAccess input) throws IOException
IOException
public byte[] readToken(IRandomAccess input) throws IOException
IOException
public byte[] readToken(IRandomAccess input, List messages) throws IOException
input
- messages
-
IOException
public void setExceptionHandler(IPDFParserExceptionHandler exceptionHandler)
|
intarsys PDF library API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |