public final class

ObjectIdentifier

extends Object
implements Serializable
java.lang.Object
   ↳ sun.security.util.ObjectIdentifier

Class Overview

Represent an ISO Object Identifier.

Object Identifiers are arbitrary length hierarchical identifiers. The individual components are numbers, and they define paths from the root of an ISO-managed identifier space. You will sometimes see a string name used instead of (or in addition to) the numerical id. These are synonyms for the numerical IDs, but are not widely used since most sites do not know all the requisite strings, while all sites can parse the numeric forms.

So for example, JavaSoft has the sole authority to assign the meaning to identifiers below the 1.3.6.1.4.1.42.2.17 node in the hierarchy, and other organizations can easily acquire the ability to assign such unique identifiers.

Summary

Public Constructors
ObjectIdentifier(String oid)
Constructs an object identifier from a string.
ObjectIdentifier(int[] values)
Constructs an object ID from an array of integers.
ObjectIdentifier(DerInputStream in)
Constructs an object ID from an ASN.1 encoded input stream.
Public Methods
boolean equals(ObjectIdentifier other)
This method is deprecated. Use equals((Object)oid)
boolean equals(Object obj)
Compares this identifier with another, for equality.
int hashCode()
Returns a hash code value for the object.
static ObjectIdentifier newInternal(int[] values)
Create a new ObjectIdentifier for internal use.
boolean precedes(ObjectIdentifier other)
Compares this identifier with another, for sorting purposes.
String toString()
Returns a string form of the object ID.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ObjectIdentifier (String oid)

Constructs an object identifier from a string. This string should be of the form 1.23.34.45.56 etc.

Throws
IOException

public ObjectIdentifier (int[] values)

Constructs an object ID from an array of integers. This is used to construct constant object IDs.

Throws
IOException

public ObjectIdentifier (DerInputStream in)

Constructs an object ID from an ASN.1 encoded input stream. The encoding of the ID in the stream uses "DER", a BER/1 subset. In this case, that means a triple { typeId, length, data }.

NOTE: When an exception is thrown, the input stream has not been returned to its "initial" state.

Parameters
in DER-encoded data holding an object ID
Throws
IOException indicates a decoding error

Public Methods

public boolean equals (ObjectIdentifier other)

This method is deprecated.
Use equals((Object)oid)

public boolean equals (Object obj)

Compares this identifier with another, for equality.

Parameters
obj the reference object with which to compare.
Returns
  • true iff the names are identical.

public int hashCode ()

Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals(java.lang.Object) method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hashtables.

As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)

Returns
  • a hash code value for this object.

public static ObjectIdentifier newInternal (int[] values)

Create a new ObjectIdentifier for internal use. The values are neither checked nor cloned.

public boolean precedes (ObjectIdentifier other)

Compares this identifier with another, for sorting purposes. An identifier does not precede itself.

Parameters
other identifer that may precede this one.
Returns
  • true iff other precedes this one in a particular sorting order.

public String toString ()

Returns a string form of the object ID. The format is the conventional "dot" notation for such IDs, without any user-friendly descriptive strings, since those strings will not be understood everywhere.

Returns
  • a string representation of the object.