public class AsnObjectId extends AsnObject implements java.lang.Comparable
contentsLength, debug, headerLength, isCorrect, startPos, type
ASN_APPLICATION, ASN_BIT_STR, ASN_BIT8, ASN_BOOLEAN, ASN_CONSTRUCTOR, ASN_CONTEXT, ASN_EXTENSION_ID, ASN_INTEGER, ASN_LONG_LEN, ASN_NULL, ASN_OBJECT_ID, ASN_OCTET_STR, ASN_PRIMITIVE, ASN_PRIVATE, ASN_SEQUENCE, ASN_SET, ASN_UNIVERSAL, CONS_SEQ, COUNTER, COUNTER64, GAUGE, GET_REQ_MSG, GET_RPRT_MSG, GET_RSP_MSG, GETBULK_REQ_MSG, GETNEXT_REQ_MSG, INFORM_REQ_MSG, INTEGER, IPADDRESS, NSAP_ADDRESS, NULLOBJ, OBJID, OBSOLETED_RFC1442_UINTEGER32, OPAQUE, SET_REQ_MSG, SMI_V2_UINTEGER32, SNMP_ERR_AUTHORIZATIONERR, SNMP_ERR_BADVALUE, SNMP_ERR_COMMITFAILED, SNMP_ERR_DECODING_EXC, SNMP_ERR_DECODINGASN_EXC, SNMP_ERR_DECODINGPKTLNGTH_EXC, SNMP_ERR_GENERR, SNMP_ERR_INCONSISTENTNAME, SNMP_ERR_INCONSISTENTVALUE, SNMP_ERR_NOACCESS, SNMP_ERR_NOCREATION, SNMP_ERR_NOERROR, SNMP_ERR_NOSUCHNAME, SNMP_ERR_NOTWRITABLE, SNMP_ERR_READONLY, SNMP_ERR_RESOURCEUNAVAILABLE, SNMP_ERR_TOOBIG, SNMP_ERR_UNDOFAILED, SNMP_ERR_WRONGENCODING, SNMP_ERR_WRONGLENGTH, SNMP_ERR_WRONGTYPE, SNMP_ERR_WRONGVALUE, SNMP_TRAP_AUTHFAIL, SNMP_TRAP_COLDSTART, SNMP_TRAP_EGPNEIGHBORLOSS, SNMP_TRAP_ENTERPRISESPECIFIC, SNMP_TRAP_LINKDOWN, SNMP_TRAP_LINKUP, SNMP_TRAP_WARMSTART, SNMP_VAR_ENDOFMIBVIEW, SNMP_VAR_NOSUCHINSTANCE, SNMP_VAR_NOSUCHOBJECT, SNMP_VERSION_1, SNMP_VERSION_2c, SNMP_VERSION_3, STRING, TIMETICKS, TRP_REQ_MSG, TRPV2_REQ_MSG
Modifier | Constructor and Description |
---|---|
protected |
AsnObjectId()
The empty constructor.
|
|
AsnObjectId(long[] oida)
Constructs an AsnObjectId out of an array of long.
|
|
AsnObjectId(java.lang.String s)
Constructs an AsnObjectId out of an OID string.
|
Modifier and Type | Method and Description |
---|---|
void |
add(long sub_oid)
Adds a single sub-identifier to the end of the OID.
|
void |
add(long[] sub_oid)
Adds a number of sub-identifiers to the end of the OID.
|
void |
add(java.lang.String s)
Adds sub-identifiers to the end of the OID.
|
int |
compareTo(AsnObjectId b) |
int |
compareTo(java.lang.Object o) |
boolean |
equals(java.lang.Object anObject)
Compares this OID to the specified object.
|
long |
getElementAt(int index)
Returns the element in the AsnObjectId at the specified index.
|
long[] |
getOid()
Returns the value of the AsnObjectId as an array of long.
|
int |
getSize()
Returns the number of elements in the AsnObjectId.
|
long[] |
getSubOid(int beginIndex,
int endIndex)
Returns a subset of the value of the AsnObjectId as an array of long.
|
java.lang.String |
getValue()
Returns the value of the AsnObjectId.
|
int |
hashCode()
Returns a hash code for this OID.
|
long |
lastElement()
Returns the last element in the AsnObjectId.
|
int |
leftMostCompare(int n,
AsnObjectId b)
Compares the n leftmost sub-identifiers with the given
AsnObject in left-to-right direction.
|
long |
removeLast()
Removes the last sub-identifier (if available) from this
OID and returns it.
|
boolean |
startsWith(AsnObjectId prefix)
Checks if this OID starts with the specified prefix.
|
java.lang.String |
toString()
Returns the string representation of the AsnObjectId.
|
java.lang.String |
toString(long[] v)
Returns the string representation of the AsnObjectId.
|
getRespType, getRespTypeString, setDebug
protected AsnObjectId()
public AsnObjectId(java.lang.String s) throws java.lang.IllegalArgumentException
s
- The OID, format a[.b]*java.lang.IllegalArgumentException
public AsnObjectId(long[] oida)
oida
- The OID, as an array of longpublic boolean startsWith(AsnObjectId prefix)
public void add(long sub_oid)
sub_oid
- The sub-identifierpublic void add(long[] sub_oid)
sub_oid
- The sub-identifiersAsnOctets.toSubOid(boolean)
public void add(java.lang.String s) throws java.lang.IllegalArgumentException
s
- The sub-identifiers, format a[.b]*java.lang.IllegalArgumentException
public long removeLast()
public java.lang.String getValue()
public java.lang.String toString()
public java.lang.String toString(long[] v)
public int getSize()
public long getElementAt(int index) throws java.lang.ArrayIndexOutOfBoundsException
index
- The indexjava.lang.ArrayIndexOutOfBoundsException
- if an invalid
index was givenpublic long lastElement() throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
- if the
AsnObjectId is empty.public long[] getOid()
public long[] getSubOid(int beginIndex, int endIndex) throws java.lang.ArrayIndexOutOfBoundsException
java.lang.ArrayIndexOutOfBoundsException
public boolean equals(java.lang.Object anObject)
true
if and only if the argument is not
null
and is a AsnObjectId
object that represents
the same sequence of numbers as this object.
Thanks to Eli Bishop (eli@graphesthesia.com) for the suggestion of adding it.
equals
in class java.lang.Object
anObject
- The object to compare this AsnObjectId
against.true
if the AsnObjectId
are equal;
false
otherwise.public int hashCode()
hashCode
in class java.lang.Object
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
Comparable.compareTo(T)
,
compareTo(AsnObjectId)
public int compareTo(AsnObjectId b)
Thanks to Josh Bers to providing this code.
public int leftMostCompare(int n, AsnObjectId b)
n
- The number of sub-identifiers to compare.b
- An AsnObject to compare with this object