Class ObjectIdentifier

java.lang.Object
org.apache.harmony.security.utils.ObjectIdentifier

public final class ObjectIdentifier
extends Object
Instance of this class represents ObjectIdentifier (OID). OID is represented as a sequence of subidentifier. Each subidentifier is represented as non negative integer value. There are at least 2 subidentifiers in the sequence. Valid values for first subidentifier are 0, 1 and 2. If the first subidentifier has 0 or 1 value the second subidentifier MUST be less then 40.
See Also:
ASN.1
  • Constructor Details

    • ObjectIdentifier

      public ObjectIdentifier​(int[] oid)
      Creates ObjectIdentifier(OID) from array of integers.
      Parameters:
      oid - - array of integers
      Throws:
      NullPointerException - - if oid is null
      IllegalArgumentException - - if oid is invalid
    • ObjectIdentifier

      public ObjectIdentifier​(int[] oid, String name, Object oidGroup)
      Creates ObjectIdentifier(OID) from array of integers.
      Parameters:
      oid - - array of integers
      name - - name of OID
      oidGroup - - OID's group. Is used to separate different OID's
      Throws:
      NullPointerException - - if oid is null
      IllegalArgumentException - - if oid is invalid
  • Method Details

    • getOid

      public int[] getOid()
      Gets OID.
      Returns:
      oid
    • getName

      public String getName()
      Gets OID's name.
      Returns:
      name
    • getGroup

      public Object getGroup()
      Gets OID's group.
      Returns:
      group
    • equals

      public boolean equals​(Object o)
      Compares object with OID for equality.
      Overrides:
      equals in class Object
      Parameters:
      o - the object to compare this instance with.
      Returns:
      true if object is ObjectIdentifier and it has the same representation as array of integers, otherwise false
      See Also:
      Object.hashCode()
    • toOIDString

      public String toOIDString()
      Add "OID." to the beginning of string representation.
      Returns:
      oid as string
    • toString

      public String toString()
      Overrides Object.toString()
      Overrides:
      toString in class Object
      Returns:
      oid as string
    • hashCode

      public int hashCode()
      Description copied from class: Object
      Returns an integer hash code for this object. By contract, any two objects for which Object.equals(java.lang.Object) returns true must return the same hash code value. This means that subclasses of Object usually override both methods or neither method.

      Note that hash values must not change over time unless information used in equals comparisons also changes.

      See Writing a correct hashCode method if you intend implementing your own hashCode method.

      Overrides:
      hashCode in class Object
      Returns:
      this object's hash code.
      See Also:
      Object.hashCode()
    • validateOid

      public static void validateOid​(int[] oid)
      Validates ObjectIdentifier (OID).
      Parameters:
      oid - - oid as array of integers
      Throws:
      NullPointerException - - if oid is null
      IllegalArgumentException - - if oid is invalid
    • hashIntArray

      public static int hashIntArray​(int[] array)
      Returns hash code for array of integers
      Parameters:
      oid - - array of integers