public abstract class PdfObject extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
static byte |
ARRAY |
static byte |
BOOLEAN |
static byte |
DICTIONARY |
protected static short |
FLUSHED
Indicates if the object has been flushed.
|
protected static short |
FORBID_RELEASE
Indicates that the object is highly sensitive and we do not want to release it even if release() is called.
|
protected static short |
FREE
Indicates that the indirect reference of the object could be reused or have to be marked as free.
|
static byte |
INDIRECT_REFERENCE |
protected PdfIndirectReference |
indirectReference
If object is flushed the indirect reference is kept here.
|
static byte |
LITERAL |
protected static short |
MODIFIED
Indicates that object changed (is used in append mode).
|
protected static short |
MUST_BE_FLUSHED
For internal usage only.
|
protected static short |
MUST_BE_INDIRECT
Indicates that the object shall be indirect when it is written to the document.
|
static byte |
NAME |
static byte |
NULL |
static byte |
NUMBER |
protected static short |
ORIGINAL_OBJECT_STREAM
Indicates that the indirect reference of the object represents ObjectStream from original document.
|
protected static short |
READ_ONLY
Indicates that we do not want this object to be ever written into the resultant document (because of multiple objects read from the same reference inconsistency).
|
protected static short |
READING
Indicates that definition of the indirect reference of the object still not found (e.g.
|
static byte |
STREAM |
static byte |
STRING |
protected static short |
UNENCRYPTED
Indicates that this object is not encrypted in the encrypted document.
|
Constructor and Description |
---|
PdfObject() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
checkState(short state)
Checks state of the flag of current object.
|
protected PdfObject |
clearState(short state)
Clear state of the flag of current object.
|
PdfObject |
clone()
Creates clone of the object which belongs to the same document as original object.
|
protected void |
copyContent(PdfObject from, PdfDocument document)
Copies object content from object 'from'.
|
PdfObject |
copyTo(PdfDocument document)
Copies object to a specified document.
|
PdfObject |
copyTo(PdfDocument document, boolean allowDuplicating)
Copies object to a specified document.
|
void |
flush()
Flushes the object to the document.
|
void |
flush(boolean canBeInObjStm)
Flushes the object to the document.
|
PdfIndirectReference |
getIndirectReference()
Gets the indirect reference associated with the object.
|
abstract byte |
getType()
Gets object type.
|
boolean |
isArray()
Checks if this PdfObject is of the type PdfArray .
|
boolean |
isBoolean()
Checks if this PdfObject is of the type PdfBoolean .
|
boolean |
isDictionary()
Checks if this PdfObject is of the type PdfDictionary .
|
boolean |
isFlushed()
Indicates is the object has been flushed or not.
|
boolean |
isIndirect()
Checks if object is indirect.
|
boolean |
isIndirectReference()
Checks if this PdfObject is of the type PdfIndirectReference .
|
boolean |
isLiteral()
Checks if this PdfObject is of the type PdfLiteral .
|
boolean |
isModified()
Indicates is the object has been set as modified or not.
|
boolean |
isName()
Checks if this PdfObject is of the type PdfName .
|
boolean |
isNull()
Checks if this PdfObject is of the type PdfNull .
|
boolean |
isNumber()
Checks if this PdfObject is of the type PdfNumber .
|
boolean |
isReleaseForbidden()
Checks if it's forbidden to release this PdfObject instance.
|
boolean |
isStream()
Checks if this PdfObject is of the type PdfStream .
|
boolean |
isString()
Checks if this PdfObject is of the type PdfString .
|
PdfObject |
makeIndirect(PdfDocument document)
Marks object to be saved as indirect.
|
PdfObject |
makeIndirect(PdfDocument document, PdfIndirectReference reference)
Marks object to be saved as indirect.
|
protected abstract PdfObject |
newInstance()
Creates new instance of object.
|
void |
release() |
protected PdfObject |
setIndirectReference(PdfIndirectReference indirectReference) |
PdfObject |
setModified()
Sets the 'modified' flag to the indirect object, the flag denotes that the object was modified since the document opening.
|
protected PdfObject |
setState(short state)
Sets special states of current object.
|
public static final byte ARRAY
public static final byte BOOLEAN
public static final byte DICTIONARY
public static final byte LITERAL
public static final byte INDIRECT_REFERENCE
public static final byte NAME
public static final byte NULL
public static final byte NUMBER
public static final byte STREAM
public static final byte STRING
protected static final short FLUSHED
protected static final short FREE
protected static final short READING
protected static final short MODIFIED
protected static final short ORIGINAL_OBJECT_STREAM
protected static final short MUST_BE_FLUSHED
protected static final short MUST_BE_INDIRECT
protected static final short FORBID_RELEASE
protected static final short READ_ONLY
protected static final short UNENCRYPTED
protected PdfIndirectReference indirectReference
public abstract byte getType()
public final void flush()
public final void flush(boolean canBeInObjStm)
canBeInObjStm
- indicates whether object can be placed into object stream.
public PdfIndirectReference getIndirectReference()
public boolean isIndirect()
true
doesn't necessarily mean that indirect reference of this object is not null at the moment. Object could be marked as indirect and be transformed to indirect on flushing.
true
if object is indirect or is to be indirect in the resultant document.
public PdfObject makeIndirect(PdfDocument document, PdfIndirectReference reference)
document
- a document the indirect reference will belong to.
public PdfObject makeIndirect(PdfDocument document)
document
- a document the indirect reference will belong to.
public boolean isFlushed()
public boolean isModified()
public PdfObject clone()
public PdfObject copyTo(PdfDocument document)
document
- document to copy object to.
public PdfObject copyTo(PdfDocument document, boolean allowDuplicating)
document
- document to copy object to.
allowDuplicating
- indicates if to allow copy objects which already have been copied. If object is associated with any indirect reference and allowDuplicating is false then already existing reference will be returned instead of copying object. If allowDuplicating is true then object will be copied and new indirect reference will be assigned.
public PdfObject setModified()
For example flag is used in the append mode (see StampingProperties.useAppendMode()
). In append mode the whole document is preserved as is, and only changes to the document are appended to the end of the document file. Because of this, only modified objects need to be flushed and are allowed to be flushed (i.e. to be written).
PdfObject
instance.
public boolean isReleaseForbidden()
PdfObject
instance. Some objects are vital for the living period of PdfDocument
or may be prevented from releasing by high-level entities dealing with the objects. Also it's not possible to release the objects that have been modified.
public void release()
public boolean isNull()
PdfObject
is of the type PdfNull
.
true
or false
public boolean isBoolean()
PdfObject
is of the type PdfBoolean
.
true
or false
public boolean isNumber()
PdfObject
is of the type PdfNumber
.
true
or false
public boolean isString()
PdfObject
is of the type PdfString
.
true
or false
public boolean isName()
PdfObject
is of the type PdfName
.
true
or false
public boolean isArray()
PdfObject
is of the type PdfArray
.
true
or false
public boolean isDictionary()
PdfObject
is of the type PdfDictionary
.
true
or false
public boolean isStream()
PdfObject
is of the type PdfStream
.
true
or false
public boolean isIndirectReference()
PdfObject
is of the type PdfIndirectReference
.
true
if this is an indirect reference, otherwise false
public boolean isLiteral()
PdfObject
is of the type PdfLiteral
.
true
if this is a literal, otherwise false
protected abstract PdfObject newInstance()
protected PdfObject setIndirectReference(PdfIndirectReference indirectReference)
protected boolean checkState(short state)
state
- special flag to check
protected PdfObject setState(short state)
state
- special flag of current object
protected PdfObject clearState(short state)
state
- special flag state to clear
protected void copyContent(PdfObject from, PdfDocument document)
from
- object to copy content from.
document
- document to copy object to.
Copyright © 1998–2020 iText Group NV. All rights reserved.