public class PdfIndirectReference extends PdfObject implements Comparable<PdfIndirectReference>
Modifier and Type | Field and Description |
---|---|
protected int |
genNr
Object generation.
|
protected int |
objectStreamNumber
Indirect reference number of object stream containing refersTo object.
|
protected int |
objNr
Object number.
|
protected long |
offsetOrIndex
Offset in a document of the refersTo object.
|
protected PdfDocument |
pdfDocument
PdfDocument object belongs to.
|
protected PdfObject |
refersTo
PdfObject that current PdfIndirectReference instance refers to.
|
ARRAY, BOOLEAN, DICTIONARY, FLUSHED, FORBID_RELEASE, FREE, INDIRECT_REFERENCE, indirectReference, LITERAL, MODIFIED, MUST_BE_FLUSHED, MUST_BE_INDIRECT, NAME, NULL, NUMBER, ORIGINAL_OBJECT_STREAM, READ_ONLY, READING, STREAM, STRING, UNENCRYPTED
Modifier | Constructor and Description |
---|---|
protected |
PdfIndirectReference(PdfDocument doc, int objNr) |
protected |
PdfIndirectReference(PdfDocument doc, int objNr, int genNr) |
protected |
PdfIndirectReference(PdfDocument doc, int objNr, int genNr, long offset) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(PdfIndirectReference o) |
protected void |
copyContent(PdfObject from, PdfDocument document)
Copies object content from object 'from'.
|
boolean |
equals(Object o) |
PdfDocument |
getDocument() |
int |
getGenNumber() |
int |
getIndex()
Gets refersTo object index in the object stream.
|
int |
getObjNumber() |
int |
getObjStreamNumber() |
long |
getOffset()
Gets refersTo object offset in a document.
|
protected PdfReader |
getReader()
Gets a PdfReader associated with the document object belongs to.
|
PdfObject |
getRefersTo() |
PdfObject |
getRefersTo(boolean recursively)
Gets direct object and try to resolve indirects chain.
|
byte |
getType()
Gets object type.
|
protected PdfWriter |
getWriter()
Gets a PdfWriter associated with the document object belongs to.
|
int |
hashCode() |
boolean |
isFree()
Checks if this PdfIndirectReference instance corresponds to free indirect reference.
|
protected PdfObject |
newInstance()
Creates new instance of object.
|
void |
setFree()
Marks indirect reference as free in the document.
|
protected void |
setRefersTo(PdfObject refersTo) |
protected PdfObject |
setState(short state)
Sets special states of current object.
|
String |
toString() |
checkState, clearState, clone, copyTo, copyTo, flush, flush, getIndirectReference, isArray, isBoolean, isDictionary, isFlushed, isIndirect, isIndirectReference, isLiteral, isModified, isName, isNull, isNumber, isReleaseForbidden, isStream, isString, makeIndirect, makeIndirect, release, setIndirectReference, setModified
protected final int objNr
protected int genNr
protected PdfObject refersTo
protected int objectStreamNumber
protected long offsetOrIndex
refersTo
object. If the object placed into object stream then it is an object index inside object stream.
protected PdfDocument pdfDocument
protected PdfIndirectReference(PdfDocument doc, int objNr)
protected PdfIndirectReference(PdfDocument doc, int objNr, int genNr)
protected PdfIndirectReference(PdfDocument doc, int objNr, int genNr, long offset)
public int getObjNumber()
public int getGenNumber()
public PdfObject getRefersTo()
public PdfObject getRefersTo(boolean recursively)
Note: If chain of references has length of more than 32, this method return 31st reference in chain.
recursively
- true
to resolve indirects chain
PdfObject
result of indirect reference resolving
protected void setRefersTo(PdfObject refersTo)
public int getObjStreamNumber()
public long getOffset()
public int getIndex()
public int compareTo(PdfIndirectReference o)
compareTo
in interface Comparable<PdfIndirectReference>
public byte getType()
PdfObject
public PdfDocument getDocument()
public void setFree()
This method will not give any result if the corresponding indirect object or another object that contains a reference to this object is already flushed.
Note: in some cases, removing a link of indirect object to it's indirect reference while leaving the actual object in the document structure might lead to errors, because some objects are expected to always have such explicit link (e.g. Catalog object, page objects, etc).
public boolean isFree()
PdfIndirectReference
instance corresponds to free indirect reference. Indirect reference might be in a free state either because it was read as such from the opened existing PDF document or because it was set free via setFree()
method.
true
if this PdfIndirectReference
is free, false
otherwise.
protected PdfWriter getWriter()
protected PdfReader getReader()
protected PdfObject newInstance()
PdfObject
newInstance
in class PdfObject
protected void copyContent(PdfObject from, PdfDocument document)
PdfObject
copyContent
in class PdfObject
from
- object to copy content from.
document
- document to copy object to.
Copyright © 1998–2022 iText Group NV. All rights reserved.