public class SnmpObjectId extends Object implements SnmpSyntax, Cloneable, Serializable
Modifier and Type | Field and Description |
---|---|
static byte |
ASNTYPE
Defines the SNMP SMI type for this particular object.
|
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(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(String strOids)
Converts the passed string to an object identifier and appends them to
the current object.
|
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.
|
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(Object o)
Test for equality.
|
int[] |
getIdentifiers()
Gets the array of object identifiers from the object.
|
int |
getLastIdentifier()
Returns the value of the last object identifier component value
|
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(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(String strOid)
Sets the object to the passed dotted decimal object identifier string.
|
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.
|
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(String strOid)
strOid
- The dotted decimal object identifier stringpublic int getLength()
public int getLastIdentifier()
public int[] getIdentifiers()
public void setIdentifiers(int[] data)
data
- The new object identifierpublic void setIdentifiers(String strOid)
strOid
- The dotted decimal object identifier.public void append(int[] ids)
ids
- The array of identifiers to appendpublic void append(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(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(Object o)
public String toString()
public int hashCode()
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
Copyright © 2021. All rights reserved.