|
HOME | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ireasoning.protocol.snmp.SnmpOID
This class represents Snmp OBJECT IDENTIFIER object. The OBJECT IDENTIFIER type represents administratively assigned names. Any instance of this type may have at most 128 sub-identifiers. Further, each sub-identifier must not exceed the value 2^32-1 (4294967295 decimal).
Field Summary | |
protected int[] |
_value
Member variables storing OID, ".1.3.2.456" will be stored as { 1, 3, 2, 456 } |
static int |
MAX_LENGTH
Max number of sub-identifier a OID can have (128) |
Fields inherited from interface com.ireasoning.protocol.snmp.SnmpDataType |
BITS, BITSTRING, COUNTER32, COUNTER64, END_OF_MIB_VIEW, END_OF_MIB_VIEW_OBJECT, GAUGE32, INTEGER, IPADDRESS, NO_SUCH_INSTANCE, NO_SUCH_INSTANCE_OBJECT, NO_SUCH_OBJECT, NO_SUCH_OBJECT_OBJECT, NULL, OCTETSTRING, OID, OPAQUE, PDU, SEQUENCE, SEQUENCEOF, serialVersionUID, TIMETICKS, UNSIGNED32, VARBIND |
Fields inherited from interface com.ireasoning.protocol.Msg |
ERROR_TYPE |
Constructor Summary | |
SnmpOID()
Constructs an empty SnmpOID objecct, whose toString() method should return "" just after construction. |
|
SnmpOID(int[] data)
Constructs a new SnmpOID by decoding the specified subarray of integers. |
|
SnmpOID(int[] data,
int length)
Constructs a new SnmpOID by decoding the specified subarray of integers. |
|
SnmpOID(int[] oid1,
int[] oid2)
Constructs a new SnmpOID which is oid1 with oid2 appended, that is, new oid = new SnmpOID(oid1).append(oid2) |
|
SnmpOID(int[] data,
int offset,
int length)
Constructs a new SnmpOID by decoding the specified subarray of integers. |
|
SnmpOID(long[] data)
Constructs a new SnmpOID by decoding the specified subarray of integers. |
|
SnmpOID(long[] data,
int length)
Constructs a new SnmpOID by decoding the specified subarray of integers. |
|
SnmpOID(long[] data,
int offset,
int length)
Constructs a new SnmpOID by decoding the specified subarray of integers. |
|
SnmpOID(SnmpOID oid)
Makes a copy of passed in oid object |
|
SnmpOID(SnmpOID oid1,
SnmpOID oid2)
Constructs a new SnmpOID which is oid1 with oid2 appended, that is, new oid = new SnmpOID(oid1).append(oid2) |
|
SnmpOID(String strOID)
Constructs an SnmpOID object from the passed in strOID |
Method Summary | |
SnmpOID |
append(int[] oid)
Appends the passed oid to itself |
SnmpOID |
append(long[] oid)
Appends the passed oid to itself |
SnmpOID |
append(SnmpOID oid)
Appends the passed oid to itself |
SnmpOID |
append(String oid)
Appends the passed oid to itself |
int |
compareTo(Object o)
Compares this object to passed object, which should be an instance of SnmpOID or an integer array representing an OID. |
int |
compareTo(SnmpOID oid)
Compares this object to passed object |
int |
compareTo(SnmpOID oid,
int length)
Compares this object to passed object, only compare first integers |
SnmpDataType |
copy()
Makes a copy of itself |
int |
encode(com.ireasoning.protocol.snmp.SnmpEncoder encoder)
For internal use |
boolean |
endsWith(int[] oid)
Checks if this SnmpOID object's oid ends with passed oid . |
boolean |
endsWith(SnmpOID oid)
Checks if this SnmpOID object's oid ends with passed oid . |
boolean |
endsWith(String oid)
Checks if this SnmpOID object's oid ends with passed oid . |
boolean |
equals(Object obj)
Check if this object equals to passed object |
int |
get(int index)
Returns the integer at specified index of this OID |
static String |
getCommonSuffix(SnmpOID oid1,
SnmpOID oid2)
Returns the common suffix of passed two OID. |
int |
getLength()
Gets the total number of fields. |
int |
getType()
Returns SnmpDataType.OID |
String |
getTypeString()
Returns "OID" |
int[] |
getValue()
Returns an array of integers which is equivalent to this one |
int |
hashCode()
Returns a hash code value for the object |
int |
indexOf(SnmpOID oid)
Returns the index within this OID of the first occurrence of the specified OID |
void |
setValue(int[] value)
Sets new OID value. |
void |
setValue(long[] value)
Sets new OID value. |
void |
setValue(SnmpOID value)
Sets new OID value. |
void |
setValue(String value)
Sets new OID value. |
boolean |
startsWith(SnmpOID prefix)
Tests if this oid starts with the specified prefix. |
boolean |
startsWith(String prefix)
Tests if this oid starts with the specified prefix. |
SnmpOID |
suboid(int beginIndex)
Returns a new SnmpOID instance that is a subset of this one. |
SnmpOID |
suboid(int beginIndex,
int endIndex)
Returns a new SnmpOID instance that is a subset of this one Example: OID ".1.3.6.1.2.1" suboid(1, 3) returns OID ".3.6" |
String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
protected int[] _value
public static final int MAX_LENGTH
Constructor Detail |
public SnmpOID()
public SnmpOID(String strOID)
public SnmpOID(int[] data, int length)
length
- - the number of integers to decode
IndexOutOfBoundsException
- if length
is larger than the length of passed data objectpublic SnmpOID(int[] data, int offset, int length)
offset
- - the index of the first int to decodelength
- - the number of integers to decode
IndexOutOfBoundsException
- if the offset is negative, or length plus offset
is larger than the length of passed data objectpublic SnmpOID(int[] data)
public SnmpOID(long[] data, int length)
length
- - the number of integers to decodedata
- a list of unsigned 32 bit integers
IndexOutOfBoundsException
- if length
is larger than the length of passed data objectpublic SnmpOID(long[] data, int offset, int length)
offset
- - the index of the first integers to decodelength
- - the number of integers to decodedata
- a list of unsigned 32 bit integers
IndexOutOfBoundsException
- if the offset is negative, or length plus offset
is larger than the length of passed data objectpublic SnmpOID(SnmpOID oid1, SnmpOID oid2)
public SnmpOID(int[] oid1, int[] oid2)
public SnmpOID(long[] data)
data
- a list of unsigned 32 bit integerspublic SnmpOID(SnmpOID oid)
Method Detail |
public int indexOf(SnmpOID oid)
public SnmpOID suboid(int beginIndex)
beginIndex
- the beginning index, inclusive.
IndexOutOfBoundsException
- if beginIndex is negative or larger than the length of this object.public SnmpOID suboid(int beginIndex, int endIndex)
beginIndex
- the beginning index, inclusive.endIndex
- the ending index, exclusive.
IndexOutOfBoundsException
- if beginIndex/endIndex is negative or larger than the length of this object,
or beginIndex is larger than endIndex.public int getLength()
public int[] getValue()
public int get(int index)
index
- the specified index of the digit to be retrieved
IndexOutOfBoundsException
- if index is out of rangepublic void setValue(int[] value)
public void setValue(long[] value)
public void setValue(String value)
public void setValue(SnmpOID value)
public boolean endsWith(String oid)
oid
. e.g. For OID
".1.3.2.456", it returns true is passed "456", ".456" or "2.456", but false if
passed "6" or "1.456"
public boolean endsWith(SnmpOID oid)
oid
. e.g. For OID
".1.3.2.456", it returns true is passed "456", ".456" or "2.456", but false if
passed "6" or "1.456"
public boolean endsWith(int[] oid)
oid
. e.g. For OID
".1.3.2.456", it returns true is passed "456", ".456" or "2.456", but false if
passed "6" or "1.456"
oid
- an integer arraypublic SnmpOID append(int[] oid)
oid
- the oid to be appeneded, it doesn't matter if it
starts with "." or not. If oids is null or empty, nothing get changed for
this object.
public SnmpOID append(long[] oid)
oid
- the oid to be appeneded, it doesn't matter if it
starts with "." or not. If oids is null or empty, nothing get changed for
this object.
public SnmpOID append(String oid)
oid
- the oid string to be appeneded, it doesn't matter if it
starts with "." or not. If oid is null or empty, nothing get changed for
this object.
public SnmpOID append(SnmpOID oid)
oid
- the oid to be appeneded
public int compareTo(Object o)
compareTo
in interface Comparable
public int compareTo(SnmpOID oid)
public int compareTo(SnmpOID oid, int length)
length
- number of integers to be compared.
public boolean startsWith(String prefix)
prefix
- - the prefix.public boolean startsWith(SnmpOID prefix)
prefix
- - the prefix.public boolean equals(Object obj)
equals
in interface SnmpDataType
obj
- the obejct to be compared.public String toString()
public int hashCode()
SnmpDataType
hashCode
in interface SnmpDataType
public int getType()
getType
in interface SnmpDataType
public String getTypeString()
getTypeString
in interface SnmpDataType
public SnmpDataType copy()
SnmpDataType
copy
in interface SnmpDataType
public int encode(com.ireasoning.protocol.snmp.SnmpEncoder encoder) throws SnmpEncodingException
SnmpDataType
encode
in interface SnmpDataType
SnmpEncodingException
public static String getCommonSuffix(SnmpOID oid1, SnmpOID oid2)
|
HOME | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |