Class COSBase

  • All Implemented Interfaces:
    COSObjectable
    Direct Known Subclasses:
    COSArray, COSBoolean, COSDictionary, COSName, COSNull, COSNumber, COSObject, COSString

    public abstract class COSBase
    extends java.lang.Object
    implements COSObjectable
    Base class for every object that can appear in the COS (Carousel Object Structure) layer of a PDF document: booleans, numbers, strings, names, arrays, dictionaries, streams, the null object and indirect references.

    Instances are, by design, mutable containers (dictionaries/arrays) except for the handful of true value types (COSName, COSBoolean, COSNull) which are effectively immutable and safely shared/interned.

    • Constructor Detail

      • COSBase

        public COSBase()
    • Method Detail

      • getObjectNumber

        public long getObjectNumber()
      • getGenerationNumber

        public int getGenerationNumber()
      • isDirect

        public boolean isDirect()
      • setKey

        public void setKey​(COSObjectKey key)
        Records the indirect object identity this value was parsed as, so that a document writer can later decide whether to inline it or reference it with "n g R".
      • getCOSObject

        public COSBase getCOSObject()
        COSObjectable identity: a raw COS node is its own COS representation.
        Specified by:
        getCOSObject in interface COSObjectable
      • resolve

        public COSBase resolve()
        Resolves through a COSObject indirection; every other COS type is already "resolved" and simply returns itself. Parsers and the COSPathEvaluator call this after every navigation step so callers never have to special-case indirect references.