public class SnmpEngineId extends Object implements Serializable
SnmpEngineId data. It copes with binary as well as String representation of an engine Id. A string format engine is an hex string starting with 0x.
This API is a Sun Microsystems internal API and is subject to change without notice.
| Modifier and Type | Field and Description |
|---|---|
(package private) byte[] |
engineId |
(package private) String |
hexString |
(package private) String |
humanString |
| Constructor and Description |
|---|
SnmpEngineId(byte[] bin)
New
SnmpEngineId with a binary value. |
SnmpEngineId(String hexString)
New
SnmpEngineId with an hex string value. |
| Modifier and Type | Method and Description |
|---|---|
static SnmpEngineId |
createEngineId()
Generates an engine Id that is unique to the host the agent is running on.
|
static SnmpEngineId |
createEngineId(byte[] arr)
Generates an engine Id based on the passed array.
|
static SnmpEngineId |
createEngineId(InetAddress addr)
Generates an engine Id based on an InetAddress.
|
static SnmpEngineId |
createEngineId(InetAddress address,
int port)
Generates a unique engine Id.
|
static SnmpEngineId |
createEngineId(InetAddress addr,
int port,
int iana)
Generates a unique engine Id.
|
static SnmpEngineId |
createEngineId(int port)
Generates a unique engine Id.
|
static SnmpEngineId |
createEngineId(int iana,
InetAddress addr)
Generates an engine Id based on an InetAddress.
|
static SnmpEngineId |
createEngineId(int port,
int iana)
Generates a unique engine Id.
|
static SnmpEngineId |
createEngineId(String str)
Generates a unique engine Id.
|
static SnmpEngineId |
createEngineId(String str,
String separator)
Idem { @link
com.sun.jmx.snmp.SnmpEngineId#createEngineId(java.lang.String) }
with the ability to provide your own separator.
|
boolean |
equals(Object a)
Tests
SnmpEngineId instance equality. |
byte[] |
getBytes()
Returns a binary engine Id.
|
String |
getReadableId()
If a string of the format <address>:<port>:<IANA number> has been provided at creation time, this string is returned.
|
int |
hashCode()
Returns a hash code value for the object.
|
(package private) void |
setStringValue(String val)
In order to store the string used to create the engineId.
|
SnmpOid |
toOid()
Translates an engine Id in an SnmpOid format.
|
String |
toString()
Returns a string format engine Id.
|
(package private) static void |
validateId(byte[] arr) |
(package private) static void |
validateId(String str) |
byte[] engineId
String humanString
SnmpEngineId(String hexString)
SnmpEngineId with an hex string value. Can handle engine Id format <host>:<port>.hexString - Hexa string.SnmpEngineId(byte[] bin)
SnmpEngineId with a binary value. You can use SnmpTools to convert from hex string to binary format.bin - Binary valuepublic String getReadableId()
public byte[] getBytes()
void setStringValue(String val)
static void validateId(String str) throws IllegalArgumentException
IllegalArgumentExceptionstatic void validateId(byte[] arr) throws IllegalArgumentException
IllegalArgumentExceptionpublic static SnmpEngineId createEngineId(byte[] arr) throws IllegalArgumentException
IllegalArgumentException - when:
public static SnmpEngineId createEngineId()
public SnmpOid toOid()
public static SnmpEngineId createEngineId(String str) throws IllegalArgumentException, UnknownHostException
Generates a unique engine Id. Hexadecimal strings as well as a textual description are supported. The textual format is as follow:
<address>:<port>:<IANA number>
The allowed formats :
str - The string to parse.UnknownHostException - if the host name contained in the textual format is unknown.IllegalArgumentException - when :
public static SnmpEngineId createEngineId(String str, String separator) throws IllegalArgumentException, UnknownHostException
str - The string to parse.separator - the separator to use. If null is provided, the default
separator ":" is used.UnknownHostException - if the host name contained in the
textual format is unknown.IllegalArgumentException - when :
public static SnmpEngineId createEngineId(int port) throws UnknownHostException
port - The TCP/IP port the SNMPv3 Adaptor Server is listening to.UnknownHostException - if the local host name
used to calculate the id is unknown.public static SnmpEngineId createEngineId(InetAddress address, int port) throws IllegalArgumentException
address - The IP address the SNMPv3 Adaptor Server is listening to.port - The TCP/IP port the SNMPv3 Adaptor Server is listening to.UnknownHostException. - if the provided address is null.IllegalArgumentExceptionpublic static SnmpEngineId createEngineId(int port, int iana) throws UnknownHostException
port - The TCP/IP port the SNMPv3 Adaptor Server is listening to.iana - Your enterprise IANA number.UnknownHostException - if the local host name used to calculate the id is unknown.public static SnmpEngineId createEngineId(InetAddress addr, int port, int iana)
addr - The IP address the SNMPv3 Adaptor Server is listening to.port - The TCP/IP port the SNMPv3 Adaptor Server is listening to.iana - Your enterprise IANA number.UnknownHostException - if the provided InetAddress is null.public static SnmpEngineId createEngineId(int iana, InetAddress addr)
iana - Your enterprise IANA number.addr - The IP address the SNMPv3 Adaptor Server is listening to.UnknownHostException - if the provided InetAddress is null.public static SnmpEngineId createEngineId(InetAddress addr)
addr - The IP address the SNMPv3 Adaptor Server is listening to.UnknownHostException - if the provided
InetAddress is null.public boolean equals(Object a)
SnmpEngineId instance equality. Two SnmpEngineId are equal if they have the same value.equals in class Objecta - the reference object with which to compare.true if the two SnmpEngineId are equals, false otherwise.Object.hashCode(),
Hashtablepublic int hashCode()
Objectjava.util.Hashtable.
The general contract of hashCode is:
hashCode method on each of
the two objects must produce the same integer result.
Object.equals(java.lang.Object)
method, then calling the hashCode method on each of the
two objects must produce distinct integer results. However, the
programmer should be aware that producing distinct integer results
for unequal objects may improve the performance of hashtables.
As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)
hashCode in class ObjectObject.equals(java.lang.Object),
Hashtable