Class CosObject

java.lang.Object
com.adobe.internal.pdftoolkit.core.cos.CosObject
Direct Known Subclasses:
CosContainer, CosScalar

public abstract class CosObject extends Object
Base class for all COS objects.
  • Field Details

  • Method Details

    • getType

      public abstract int getType()
      return which of the concrete subtypes of CosObject we are
      Returns:
      one of the t_Mumble static final int values defined above
    • getValue

      public abstract Object getValue() throws PDFCosParseException, PDFIOException, PDFSecurityException
      Returns:
      Object value of CosObject
      Throws:
      PDFCosParseException
      PDFIOException
      PDFSecurityException
    • isIndirect

      public boolean isIndirect()
    • getObjNum

      public int getObjNum()
      Indirect object number or zero if direct
    • getObjGen

      public int getObjGen()
      Indirect object generation or -1 if direct
    • getObjEOF

      public long getObjEOF()
      Return EOF of object's update section or zero if cannot be determined.
    • getObjRevision

      public int getObjRevision()
      Return index of object's update section or -1 if cannot be determined.
    • getObjPos

      public long getObjPos()
      Return object's position or zero if cannot be determined.
    • isCompressed

      public boolean isCompressed()
      Returns true if this INDIRECT object currently resides in an object stream. Returns false always if direct.
    • intValue

      public int intValue()
      Accessor functions for scalar CosObjects. These are defined in the base class to avoid having to make an explicit cast after determining the subclass by either getType() or instanceof. The ones defined in the base class all throw RuntimeException. For each scalar subclass the appropriate method is overridden, so getting here represents a "can't happen" situation.
    • longValue

      public long longValue()
      Returns long value if it's type of CosNumeric else throws exception.
    • doubleValue

      public double doubleValue()
      Returns double value if it's type of CosNumeric else throws exception.
    • numberValue

      public Number numberValue()
      Returns number value if it's type of CosNumeric else throws exception.
    • booleanValue

      public boolean booleanValue()
      Returns boolean value if it's type of CosBoolean else throws exception.
    • nameValue

      public ASName nameValue()
      Returns name value if it's type of CosName else throws exception.
    • stringValue

      public ASString stringValue() throws PDFSecurityException
      Returns string value if it's type of CosString else throws exception.
      Throws:
      PDFSecurityException
    • hexStringValue

      public ASHexString hexStringValue() throws PDFSecurityException
      Returns hex string value if it's type of CosString else throws exception.
      Throws:
      PDFSecurityException
    • textValue

      public String textValue() throws PDFSecurityException
      Returns text value if it's type of CosString else throws exception.
      Throws:
      PDFSecurityException
    • getDocument

      public CosDocument getDocument()
      Obtain the COS document that contains this object.
      Returns:
      COSDocument containing this object.
    • getStreamManager

      public StreamManager getStreamManager()
      Obtain the StreamManager for the document containing this object.
      Returns:
      StreamManager to use for this COS object.
    • isDirty

      public boolean isDirty()
      Returns if this cosobject is dirty, else false.
    • toString

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

      public abstract boolean equals(CosObject value)
      This method returns true if either they have same reference or have same data inside. Returns false if passed CosObject is not on same document.
      Parameters:
      value -
      Returns:
      boolean
    • equals

      public boolean equals(Object value)
      Object.equals(Object) is overridden here.
      Overrides:
      equals in class Object