Class COSObjectKey

java.lang.Object
org.apache.pdfbox.cos.COSObjectKey
All Implemented Interfaces:
Comparable<COSObjectKey>

public final class COSObjectKey extends Object implements Comparable<COSObjectKey>
Object representing the physical reference to an indirect pdf object.
  • Field Details

    • NUMBER_OFFSET

      private static final int NUMBER_OFFSET
      See Also:
    • GENERATION_MASK

      private static final long GENERATION_MASK
    • numberAndGeneration

      private final long numberAndGeneration
    • streamIndex

      private final int streamIndex
  • Constructor Details

    • COSObjectKey

      public COSObjectKey(long num, int gen)
      Constructor.
      Parameters:
      num - The object number.
      gen - The object generation number.
    • COSObjectKey

      public COSObjectKey(long num, int gen, int index)
      Constructor.
      Parameters:
      num - The object number.
      gen - The object generation number.
      index - The index within a compressed object stream
  • Method Details

    • computeInternalHash

      public static long computeInternalHash(long num, int gen)
      Calculate the internal hash value for the given object number and generation number.
      Parameters:
      num - the object number
      gen - the generation number
      Returns:
      the internal hash for the given values
    • getInternalHash

      public long getInternalHash()
      Return the internal hash value which is based on the number and the generation.
      Returns:
      the internal hash value
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getGeneration

      public int getGeneration()
      This will get the object generation number.
      Returns:
      The object generation number.
    • getNumber

      public long getNumber()
      This will get the object number.
      Returns:
      The object number.
    • getStreamIndex

      public int getStreamIndex()
      The index within a compressed object stream.
      Returns:
      the index within a compressed object stream if applicable otherwise -1
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

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

      public int compareTo(COSObjectKey other)
      Specified by:
      compareTo in interface Comparable<COSObjectKey>