|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.pdfbox.pdfparser.XrefTrailerResolver
public class XrefTrailerResolver
This class will collect all XRef/trailer objects and creates correct
xref/trailer information after all objects are read using startxref
and 'Prev' information (unused XRef/trailer objects are discarded).
In case of missing startxref or wrong startxref pointer all
XRef/trailer objects are used to create xref table / trailer dictionary
in order they occur.
For each new xref object/XRef stream method #nextXrefObj(int)
must be called with start byte position. All following calls to
#setXRef(COSObjectKey, int)
or setTrailer(COSDictionary)
will add the data for this byte position.
After all objects are parsed the startxref position must be provided
using #setStartxref(int)
. This is used to build the chain of
active xref/trailer objects used for creating document trailer and xref table.
Constructor Summary | |
---|---|
XrefTrailerResolver()
|
Method Summary | |
---|---|
java.util.Set<java.lang.Long> |
getContainedObjectNumbers(int objstmObjNr)
Returns object numbers which are referenced as contained in object stream with specified object number. |
COSDictionary |
getCurrentTrailer()
Returns the trailer last set by setTrailer(COSDictionary) . |
COSDictionary |
getFirstTrailer()
|
COSDictionary |
getLastTrailer()
|
COSDictionary |
getTrailer()
Gets the resolved trailer. |
java.util.Map<COSObjectKey,java.lang.Long> |
getXrefTable()
Gets the resolved xref table. |
void |
nextXrefObj(long startBytePos)
Signals that a new XRef object (table or stream) starts. |
void |
setStartxref(long startxrefBytePosValue)
Sets the byte position of the first XRef (has to be called after very last startxref was read). |
void |
setTrailer(COSDictionary trailer)
Adds trailer information for current XRef object. |
void |
setXRef(COSObjectKey objKey,
long offset)
Populate XRef HashMap of current XRef object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XrefTrailerResolver()
Method Detail |
---|
public final COSDictionary getFirstTrailer()
public final COSDictionary getLastTrailer()
public void nextXrefObj(long startBytePos)
startBytePos
- the offset to start atpublic void setXRef(COSObjectKey objKey, long offset)
objKey
- The objkey, with id and gen numbersoffset
- The byte offset in this filepublic void setTrailer(COSDictionary trailer)
trailer
- the current document trailer dictionarypublic COSDictionary getCurrentTrailer()
setTrailer(COSDictionary)
.
public void setStartxref(long startxrefBytePosValue)
startxrefBytePosValue
- starting position of the first XRefpublic COSDictionary getTrailer()
null
in case
#setStartxref(int)
was not called before.
public java.util.Map<COSObjectKey,java.lang.Long> getXrefTable()
null
in case
#setStartxref(int)
was not called before.
public java.util.Set<java.lang.Long> getContainedObjectNumbers(int objstmObjNr)
objstmObjNr
- object number of object stream for which contained object numbers
should be returned
null
if setStartxref(long)
was not
called before so that no resolved xref table exists
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |