|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.management.snmp.SnmpValue com.sun.management.snmp.SnmpOid
public class SnmpOid
Represents an SNMP Object Identifier (OID).
Field Summary | |
---|---|
protected int |
componentCount
The length of the components' array. |
protected long[] |
components
The components' array. |
Fields inherited from interface com.sun.management.snmp.SnmpDataTypeEnums |
---|
ApplFlag, BitStringTag, BooleanTag, Counter64Tag, CounterTag, CtxtFlag, errEndOfMibViewTag, errNoSuchInstanceTag, errNoSuchObjectTag, GaugeTag, IntegerTag, IpAddressTag, NsapTag, NullTag, ObjectIdentiferTag, ObjectIdentifierTag, OctetStringTag, OpaqueTag, SequenceTag, TableTag, TimeticksTag, UintegerTag, UnknownSyntaxTag |
Constructor Summary | |
---|---|
SnmpOid()
Constructs a new SnmpOid with no components. |
|
SnmpOid(long id)
Constructs a new SnmpOid containing one component with the
specified value. |
|
SnmpOid(long[] oidComponents)
Constructs a new SnmpOid from the specified component array. |
|
SnmpOid(long id1,
long id2,
long id3,
long id4)
Constructs a new SnmpOid containing four components with
the specified values. |
|
SnmpOid(String s)
Constructs a new SnmpOid from a dot-formatted String or a MIB variable
name. |
Method Summary | |
---|---|
void |
addToOid(long[] oid)
Adds the specified array of longs to the end of this SnmpOid . |
void |
addToOid(String s)
Adds the specified dot-formatted OID String to the end of this SnmpOid . |
void |
append(long id)
Appends the specified long to the end of this SnmpOid . |
void |
append(SnmpOid oid)
Appends the specified SnmpOid to the end of this SnmpOid . |
static void |
appendToOid(SnmpOid source,
SnmpOid dest)
Appends an SnmpOid representing an SnmpOid to another OID. |
Object |
clone()
Clones the SnmpOid object, making a copy of its data. |
int |
compareTo(SnmpOid other)
Compares two OIDs lexicographically. |
SnmpValue |
duplicate()
Performs a clone action. |
boolean |
equals(Object o)
Checks whether the specified Object is equal to this SnmpOid . |
int |
getLength()
Gets the number of components in this OID. |
long |
getOidArc(int pos)
Returns the value of the OID arc found at the requested position in the components array. |
static SnmpOidTable |
getSnmpOidTable()
Returns the MIB table used for resolving MIB variable names. |
String |
getTypeName()
Returns a textual description of the type object. |
int |
hashCode()
The hashCode is computed from the OID components. |
void |
insert(int id)
Inserts a subidentifier at the beginning of this SnmpOid . |
void |
insert(long id)
Inserts a subidentifier at the beginning of this SnmpOid . |
boolean |
isValid()
Checks the validity of the OID. |
long[] |
longValue()
Returns a copy of the components array of this SnmpOid . |
long[] |
longValue(boolean duplicate)
Returns the components array of this SnmpOid . |
static int |
nextOid(long[] index,
int start)
Scans an index OID, skips the OID value and returns the position of the next value. |
String |
resolveVarName(String s)
Resolves a MIB variable String with the MIB database. |
static void |
setSnmpOidTable(SnmpOidTable db)
Sets the MIB table to use for resolving MIB variable names. |
Boolean |
toBoolean()
Converts the OID value to its Boolean form. |
Byte[] |
toByte()
Converts the OID value to its array of Bytes form. |
Integer |
toInteger()
Converts the OID value to its Integer form. |
Long |
toLong()
Converts the OID value to its Long form. |
String |
toOctetString()
Converts an OID index converted string back to a DisplayString |
SnmpOid |
toOid()
Converts the OID value to its SnmpOid form. |
static SnmpOid |
toOid(long[] index,
int start)
Extracts the OID from an index OID and returns its value converted as an SnmpOid . |
String |
toString()
Converts the OID value to its String form. |
UnsignedLong |
toUnsignedLong()
|
Methods inherited from class com.sun.management.snmp.SnmpValue |
---|
isEndOfMibViewValue, isNoSuchInstanceValue, isNoSuchObjectValue, toAsn1String |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected long[] components
protected int componentCount
Constructor Detail |
---|
public SnmpOid()
SnmpOid
with no components.
public SnmpOid(long[] oidComponents)
SnmpOid
from the specified component array.
oidComponents
- The initialization component array.public SnmpOid(long id)
SnmpOid
containing one component with the
specified value.
id
- The initialization component value.public SnmpOid(long id1, long id2, long id3, long id4)
SnmpOid
containing four components with
the specified values.
id1
- The first component values.id2
- The second component values.id3
- The third component values.id4
- The fourth component values.public SnmpOid(String s) throws IllegalArgumentException
SnmpOid
from a dot-formatted String
or a MIB variable
name. It generates an exception if the variable name cannot be resolved, or
if the dot-formatted String
has an invalid subidentifier.
This constructor helps build an OID object with a String
like .1.2.3.4 or 1.2.3.4
or ifInOctets
or ifInOctets
.0.
s
- String
or MIB variable of the form .1.2.3 or 1.2.3 or ifInOctets
.
IllegalArgumentException
- The subidentifier is neither a numeric String
nor a String
of the MIB database.Method Detail |
---|
public int getLength()
public long[] longValue()
SnmpOid
.
public final long[] longValue(boolean duplicate)
SnmpOid
.
If duplicate
is true, a copy is returned.
Otherwise, a reference to the internal array is returned,
in which case the caller shall not modify this array.
This method is provided to optimize processing in those cases
where the caller needs only to read the components array.
duplicate
- Indicates whether a copy or a reference must
be returned:
true
if a copy must be returned,false
if a reference on the internal data
can be returned.public final long getOidArc(int pos) throws SnmpStatusException
components
array. The first element is at
position 0
.
pos
- The position at which the OID arc should be peeked.
SnmpStatusException
- No OID arc was found at the requested
position.public UnsignedLong toUnsignedLong()
public Long toLong()
Long
form.
Long
representation of the value.public Integer toInteger()
Integer
form.
Integer
representation of the value.public String toString()
String
form.
toString
in class Object
String
representation of the value.public Boolean toBoolean()
Boolean
form.
Boolean
representation of the value.public Byte[] toByte()
Bytes
form.
Bytes
representation of the value.public SnmpOid toOid()
SnmpOid
form.
toOid
in class SnmpValue
public static SnmpOid toOid(long[] index, int start) throws SnmpStatusException
SnmpOid
.
index
- The index array.start
- The position in the index array.
SnmpStatusException
- There is no OID value
available at the start position.public static int nextOid(long[] index, int start) throws SnmpStatusException
index
- The index array.start
- The position in the index array.
SnmpStatusException
- There is no OID value
available at the start position.public static void appendToOid(SnmpOid source, SnmpOid dest)
SnmpOid
representing an SnmpOid
to another OID.
source
- An OID representing an SnmpOid
value.dest
- Where source should be appended.public final SnmpValue duplicate()
SnmpValue
interface.
duplicate
in class SnmpValue
public Object clone()
SnmpOid
object, making a copy of its data.
clone
in class Object
public void insert(long id)
SnmpOid
.
id
- The long subidentifier to insert.public void insert(int id)
SnmpOid
.
id
- The integer subidentifier to insert.public void append(SnmpOid oid)
SnmpOid
to the end of this SnmpOid
.
oid
- The OID to append.public void append(long id)
SnmpOid
.
id
- The long to append.public void addToOid(String s) throws SnmpStatusException
String
to the end of this SnmpOid
.
The subidentifiers can be expressed as a dot-formatted String
or a
MIB variable name.
s
- Variable name of the form .1.2.3 or 1.2.3 or
ifInOctets
.
SnmpStatusException
- An error occurred while accessing a MIB node.public void addToOid(long[] oid) throws SnmpStatusException
SnmpOid
.
oid
- An array of longs.
SnmpStatusException
- An error occurred while accessing a MIB node.public boolean isValid()
true
if the OID is valid, false
otherwise.public boolean equals(Object o)
Object
is equal to this SnmpOid
.
equals
in class Object
o
- The Object
to be compared.
true
if o
is an SnmpOid
instance and equal to this, false
otherwise.public int hashCode()
hashCode
in class Object
public int compareTo(SnmpOid other)
other
- The OID to be compared.
other
is equal to this SnmpOid
.
A value smaller than 0 if this SnmpOid
is lexicographically smaller than other
.
A value larger than 0 if this SnmpOid
is lexicographically larger than other
.public String resolveVarName(String s) throws SnmpStatusException
String
with the MIB database.
s
- The variable name to resolve.
SnmpStatusException
- If the variable is not found in the MIB database.public String getTypeName()
getTypeName
in class SnmpValue
public static SnmpOidTable getSnmpOidTable()
public static void setSnmpOidTable(SnmpOidTable db)
db
- The MIB table to use.public String toOctetString()
|
Open Source build 02 opendmk-1.0-b02 2007.10.01_19:17:46_MEST |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |