public class XrefTrailerResolver extends Object
nextXrefObj(long, XRefType)
must be called with start byte position. All following calls to
setXRef(COSObjectKey, long)
or setTrailer(COSDictionary)
will add the data for this byte position.
After all objects are parsed the startxref position must be provided
using setStartxref(long)
. This is used to build the chain of
active xref/trailer objects used for creating document trailer and xref table.Modifier and Type | Class and Description |
---|---|
static class |
XrefTrailerResolver.XRefType
The XRefType of a trailer.
|
Constructor and Description |
---|
XrefTrailerResolver() |
Modifier and Type | Method and Description |
---|---|
Set<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()
Returns the first trailer if at least one exists.
|
COSDictionary |
getLastTrailer()
Returns the last trailer if at least one exists.
|
COSDictionary |
getTrailer()
Gets the resolved trailer.
|
int |
getTrailerCount()
Returns the count of trailers.
|
Map<COSObjectKey,Long> |
getXrefTable()
Gets the resolved xref table.
|
XrefTrailerResolver.XRefType |
getXrefType()
Returns the XRefTxpe of the resolved trailer.
|
void |
nextXrefObj(long startBytePos,
XrefTrailerResolver.XRefType type)
Signals that a new XRef object (table or stream) starts.
|
protected void |
reset()
Reset all data so that it can be used to rebuild the trailer.
|
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.
|
public final COSDictionary getFirstTrailer()
public final COSDictionary getLastTrailer()
public final int getTrailerCount()
public void nextXrefObj(long startBytePos, XrefTrailerResolver.XRefType type)
startBytePos
- the offset to start attype
- the type of the Xref objectpublic XrefTrailerResolver.XRefType getXrefType()
public 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(long)
was not called before.public Map<COSObjectKey,Long> getXrefTable()
null
in case
setStartxref(long)
was not called before.public Set<Long> getContainedObjectNumbers(int objstmObjNr)
objstmObjNr
- object number of object stream for which contained object numbers
should be returnednull
if setStartxref(long)
was not
called before so that no resolved xref table existsprotected void reset()
Copyright © 2002–2018 The Apache Software Foundation. All rights reserved.