public class Parser extends Object
Constructor and Description |
---|
Parser(Tokenizer tokenizer)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
getArrayDepth()
Returns the number of array starts not yet matched by
array ends.
|
int |
getDictDepth()
Returns the number of dictionary starts not yet matched by
dictionary ends.
|
Set<String> |
getLanguageCodes()
Returns the language code set from the Tokenizer.
|
Token |
getNext()
Gets a token.
|
Token |
getNext(Class<?> clas,
String errMsg)
A class-sensitive version of getNext.
|
Token |
getNext(long max)
Gets a token.
|
long |
getOffset()
Returns the current offset into the file.
|
boolean |
getPDFACompliant()
Returns false if either the parser or the tokenizer has detected
non-compliance with PDF/A restrictions.
|
String |
getWSString()
Returns the Tokenizer's current whitespace string.
|
PdfArray |
readArray()
Reads an array.
|
PdfDictionary |
readDictionary()
Reads a dictionary.
|
PdfObject |
readObject(boolean allowPseudo)
Reads an object.
|
PdfObject |
readObjectDef()
Reads an object definition, from wherever we are in the stream to
the completion of one full object after the obj keyword.
|
PdfObject |
readObjectDef(Numeric objNumTok)
Reads an object definition, given the first numeric object, which
has already been read and is passed as an argument.
|
void |
reset()
Clear the state of the parser so that it can start
reading at a different place in the file.
|
void |
resetLoose()
Clear the state of the parser so that it can start
reading at a different place in the file and ignore
any nesting errors.
|
void |
scanMode(boolean flag)
If true, do not attempt to parse non-whitespace delimited tokens, e.g.,
literal and hexadecimal strings.
|
void |
seek(long offset)
Positions the file to the specified offset, and
resets the state for a new token stream.
|
void |
setEncrypted(boolean encrypted)
Tells this Parser, and its Tokenizer, whether the file
is encrypted.
|
void |
setObjectMap(Map<Long,PdfObject> objectMap)
Set the object map on which the parser will work.
|
void |
setPDFACompliant(boolean pdfACompliant)
Set the value of the pdfACompliant flag.
|
public Parser(Tokenizer tokenizer)
tokenizer
- The Tokenizer which the parser will usepublic void setObjectMap(Map<Long,PdfObject> objectMap)
public void reset()
public void resetLoose()
public Token getNext() throws IOException, PdfException
IOException
PdfException
public Token getNext(long max) throws IOException, PdfException
max
- Maximum allowable size of the tokenIOException
PdfException
public Token getNext(Class<?> clas, String errMsg) throws IOException, PdfException
IOException
PdfException
public int getDictDepth()
public void setEncrypted(boolean encrypted)
public int getArrayDepth()
public String getWSString()
public Set<String> getLanguageCodes()
public boolean getPDFACompliant()
true
is no guarantee that the file is compliant.public void setPDFACompliant(boolean pdfACompliant)
true
, the tokenizer's pdfACompliant
flag is also set to true
.public PdfObject readObjectDef() throws IOException, PdfException
IOException
PdfException
public PdfObject readObjectDef(Numeric objNumTok) throws IOException, PdfException
IOException
PdfException
public PdfObject readObject(boolean allowPseudo) throws IOException, PdfException
IOException
PdfException
public PdfArray readArray() throws IOException, PdfException
IOException
PdfException
public PdfDictionary readDictionary() throws IOException, PdfException
IOException
PdfException
public long getOffset()
public void seek(long offset) throws IOException, PdfException
IOException
PdfException
public void scanMode(boolean flag)
flag
- Scan mode flagCopyright © 2008–2017 The Open Preservation Foundation. All rights reserved.