org.apache.pdfbox.cos

## 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.

Author:
  Michael Traut

### Constructor Summary

Constructors
Constructor and Description
`COSObjectKey(long num, int gen)` Constructor.
`COSObjectKey(long num, int gen, int index)` Constructor.

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`int` `compareTo(COSObjectKey other)`
`static long` `computeInternalHash(long num, int gen)` Calculate the internal hash value for the given object number and generation number.
`boolean` `equals(Object obj)`
`int` `getGeneration()` This will get the object generation number.
`long` `getInternalHash()` Return the internal hash value which is based on the number and the generation.
`long` `getNumber()` This will get the object number.
`int` `getStreamIndex()` The index within a compressed object stream.
`int` `hashCode()`
`String` `toString()`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### 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 Detail

#### 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>`