Class COSObject

java.lang.Object
org.apache.pdfbox.cos.COSBase
org.apache.pdfbox.cos.COSObject
All Implemented Interfaces:
COSUpdateInfo, COSObjectable

public class COSObject extends COSBase implements COSUpdateInfo
This class represents a PDF object.
  • Field Details

    • baseObject

      private COSBase baseObject
    • parser

      private ICOSParser parser
    • isDereferenced

      private boolean isDereferenced
    • updateState

      private final COSUpdateState updateState
    • LOG

      private static final org.apache.commons.logging.Log LOG
  • Constructor Details

    • COSObject

      public COSObject(COSBase object)
      Constructor.
      Parameters:
      object - The object that this encapsulates.
    • COSObject

      public COSObject(COSBase object, COSObjectKey objectKey)
      Constructor.
      Parameters:
      object - The object that this encapsulates.
      objectKey - The COSObjectKey of the encapsulated object
    • COSObject

      public COSObject(COSBase object, ICOSParser parser)
      Constructor.
      Parameters:
      object - The object that this encapsulates.
      parser - The parser to be used to load the object on demand
    • COSObject

      public COSObject(COSObjectKey key, ICOSParser parser)
      Constructor.
      Parameters:
      key - The object number of the encapsulated object.
      parser - The parser to be used to load the object on demand
  • Method Details

    • isObjectNull

      public boolean isObjectNull()
      Indicates if the referenced object is present or not.
      Returns:
      true if the indirect object is dereferenced
    • getObject

      public COSBase getObject()
      This will get the object that this object encapsulates.
      Returns:
      The encapsulated object.
    • setToNull

      public final void setToNull()
      Sets the referenced object to COSNull and removes the initially assigned parser.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getObjectNumber

      @Deprecated public long getObjectNumber()
      Deprecated.
      will be removed in 4.0.0
      Getter for property objectNumber.
      Returns:
      Value of property objectNumber.
    • getGenerationNumber

      @Deprecated public int getGenerationNumber()
      Deprecated.
      will be removed in 4.0.0
      Getter for property generationNumber.
      Returns:
      Value of property generationNumber.
    • accept

      public void accept(ICOSVisitor visitor) throws IOException
      visitor pattern double dispatch method.
      Specified by:
      accept in class COSBase
      Parameters:
      visitor - The object to notify when visiting this object.
      Throws:
      IOException - If an error occurs while visiting this object.
    • isDereferenced

      public boolean isDereferenced()
      Returns true, if the hereby referenced COSBase has already been parsed and loaded.
      Returns:
      true, if the hereby referenced COSBase has already been parsed and loaded.
    • getUpdateState

      public COSUpdateState getUpdateState()
      Returns the current COSUpdateState of this COSObject.
      Specified by:
      getUpdateState in interface COSUpdateInfo
      Returns:
      The current COSUpdateState of this COSObject.
      See Also: