public class SnmpObjectId extends java.lang.Object implements SnmpSyntax, java.lang.Cloneable, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
static byte |
ASNTYPE
Defines the SNMP SMI type for this particular
object.
|
private int[] |
m_data
The array of object identifiers
minimum length for a valid object id is 2 (.0.0)
|
(package private) static long |
serialVersionUID
Deifnes the version of the serialization format.
|
Constructor and Description |
---|
SnmpObjectId()
Creates a default empty object identifier.
|
SnmpObjectId(int[] data)
Creates an object identifier from the passed
array of identifiers.
|
SnmpObjectId(SnmpObjectId second)
Creates a duplicate object.
|
SnmpObjectId(java.lang.String strOid)
Creates an object identifier from the pased
dotted decimal object identifier string.
|
Modifier and Type | Method and Description |
---|---|
void |
append(int[] ids)
Appends the specified identifiers to the
current object.
|
void |
append(SnmpObjectId second)
Appends the passed SnmpObjectId object to
self.
|
void |
append(java.lang.String strOids)
Converts the passed string to an object identifier
and appends them to the current object.
|
java.lang.Object |
clone()
Implements the cloneable interface.
|
int |
compare(int[] ids)
Lexigraphically compares the object identifer to
the array of identifiers.
|
int |
compare(int[] ids,
int dist)
Lexigraphically compares the object identifer to
the array of identifiers.
|
int |
compare(SnmpObjectId cmp)
Lexigraphically compares the object identifer to
the passed object identifer.
|
private static int[] |
convert(java.lang.String idstr)
Converts a textual object identifier to an
array of integer values.
|
int |
decodeASN(byte[] buf,
int offset,
AsnEncoder encoder)
Decodes the ASN.1 object identifer from the passed buffer.
|
SnmpSyntax |
duplicate()
Serves the same purpose as the method clone().
|
int |
encodeASN(byte[] buf,
int offset,
AsnEncoder encoder)
Encodes the ASN.1 object identifier using the passed encoder and stores
the results in the passed buffer.
|
boolean |
equals(java.lang.Object o)
Test for equality.
|
int[] |
getIdentifiers()
Gets the array of object identifiers from the
object.
|
int |
getLength()
Gets the number of object identifiers
in the object.
|
int |
hashCode()
Returns a computed hash code value for the object
identifier.
|
boolean |
isRootOf(SnmpObjectId leaf)
Compares the passed object identifier against self
to determine if self is the root of the passed object.
|
void |
prepend(int[] ids)
Prepends the passed set of identifiers to
the front of the object.
|
void |
prepend(SnmpObjectId second)
Prepends the passed SnmpObjectId object to
self.
|
void |
prepend(java.lang.String strOids)
Converts the passed string to an object identifier
and prepends them to the current object.
|
void |
setIdentifiers(int[] data)
Sets the object to the passed object identifier
|
void |
setIdentifiers(java.lang.String strOid)
Sets the object to the passed dotted decimal
object identifier string.
|
java.lang.String |
toString()
Converts the object identifier to a dotted decimal
string representation.
|
byte |
typeId()
Used to get the ASN.1 type for this particular object.
|
static final long serialVersionUID
private int[] m_data
public static final byte ASNTYPE
public SnmpObjectId()
public SnmpObjectId(int[] data)
data
- The array of object identifierspublic SnmpObjectId(SnmpObjectId second)
second
- The object to copypublic SnmpObjectId(java.lang.String strOid)
strOid
- The dotted decimal object identifier stringprivate static int[] convert(java.lang.String idstr)
idstr
- An object identifier stringpublic int getLength()
public int[] getIdentifiers()
public void setIdentifiers(int[] data)
data
- The new object identifierpublic void setIdentifiers(java.lang.String strOid)
strOid
- The dotted decimal object identifier.public void append(int[] ids)
ids
- The array of identifiers to appendpublic void append(java.lang.String strOids)
strOids
- The dotted decimal identifiers to appendpublic void append(SnmpObjectId second)
second
- The object to append to selfpublic void prepend(int[] ids)
ids
- The list of identifierspublic void prepend(java.lang.String strOids)
strOids
- The dotted decimal identifiers to prependpublic void prepend(SnmpObjectId second)
second
- The object to prepend to selfpublic int compare(int[] ids)
ids
- The array if identifier to comparepublic int compare(int[] ids, int dist)
ids
- The array if identifier to compare.dist
- The maximum number of ids to compare.public int compare(SnmpObjectId cmp)
cmp
- The object identifier to comparepublic boolean isRootOf(SnmpObjectId leaf)
Compares the passed object identifier against self to determine if self is the root of the passed object. If the passed object is in the same root tree as self then a true value is returned. Otherwise a false value is returned from the object.
leaf
- The object to be testedpublic boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- The object to be tested for equality.public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public byte typeId()
typeId
in interface SnmpSyntax
public int encodeASN(byte[] buf, int offset, AsnEncoder encoder) throws AsnEncodingException
encodeASN
in interface SnmpSyntax
buf
- The buffer to write the encoded information.offset
- The offset to start writing informationencoder
- The encoder object.AsnEncodingException
- Thrown if the encoder finds an error in the
buffer.public int decodeASN(byte[] buf, int offset, AsnEncoder encoder) throws AsnDecodingException
decodeASN
in interface SnmpSyntax
buf
- The encode bufferoffset
- The offset byte to begin decodingencoder
- The decoder object.AsnDecodingException
- Thrown by the encoder if an error
occurs trying to decode the data buffer.public SnmpSyntax duplicate()
duplicate
in interface SnmpSyntax
public java.lang.Object clone()
clone
in class java.lang.Object
Generated by iurt on 2015.