Package org.apache.pdfbox.cos
Class COSObjectKey
- java.lang.Object
-
- org.apache.pdfbox.cos.COSObjectKey
-
- All Implemented Interfaces:
java.lang.Comparable<COSObjectKey>
public final class COSObjectKey extends java.lang.Object implements java.lang.Comparable<COSObjectKey>
Object representing the physical reference to an indirect pdf object.
-
-
Field Summary
Fields Modifier and Type Field Description private static longGENERATION_MASKprivate static intNUMBER_OFFSETprivate longnumberAndGenerationprivate intstreamIndex
-
Constructor Summary
Constructors Constructor 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 Modifier and Type Method Description intcompareTo(COSObjectKey other)static longcomputeInternalHash(long num, int gen)Calculate the internal hash value for the given object number and generation number.booleanequals(java.lang.Object obj)intgetGeneration()This will get the object generation number.longgetInternalHash()Return the internal hash value which is based on the number and the generation.longgetNumber()This will get the object number.intgetStreamIndex()The index within a compressed object stream.inthashCode()java.lang.StringtoString()
-
-
-
Field Detail
-
NUMBER_OFFSET
private static final int NUMBER_OFFSET
- See Also:
- Constant Field Values
-
GENERATION_MASK
private static final long GENERATION_MASK
-
numberAndGeneration
private final long numberAndGeneration
-
streamIndex
private final int streamIndex
-
-
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 numbergen- 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(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.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:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
compareTo
public int compareTo(COSObjectKey other)
- Specified by:
compareToin interfacejava.lang.Comparable<COSObjectKey>
-
-