com.adventnet.snmp.snmp2
Class  SnmpIpAddress
java.lang.Object
  |
  +--com.adventnet.snmp.snmp2.SnmpVar
        |
        +--com.adventnet.snmp.snmp2.SnmpString
              |
              +--com.adventnet.snmp.snmp2.SnmpIpAddress
- All Implemented Interfaces: 
 - java.io.Serializable
 
- Direct Known Subclasses: 
 - SnmpNetworkAddress
 
- public class SnmpIpAddress
- extends SnmpString
  
Class of SNMP IpAddress Variable - Sub-class of SnmpVar.
 This class can be used to created a SnmpVar object of type SnmpIpAddress.
 It also has methods to retrieve the value in different forms(eg. String,
 byte).
 Value is stored as String of length 4 with each lower byte
 corresponding to the raw IP address.
- See Also: 
 - Serialized Form
 
| Fields inherited from class com.adventnet.snmp.snmp2.SnmpString | 
enc | 
 
| 
Constructor Summary | 
SnmpIpAddress(byte[] b)
 
          Constructs a new SnmpIpAddress by accepting the raw 
 IP address - 4 bytes. | 
SnmpIpAddress(java.lang.String s)
 
          Constructs a new SnmpIpAddress with the specified host name 
 or IP address as a string. | 
 
| 
Method Summary | 
 java.lang.Object | 
getVarObject()
 
          Returns the values of this SnmpIpAddress as a printable 
 String object. | 
static java.lang.String | 
netbToString(byte[] rawIpAddr)
 
          A converter from raw IP address (byte[]) to string. | 
 java.lang.String | 
toHostName()
 
          To convert the object to a host name. | 
 java.lang.String | 
toString()
 
          To convert the value of this SnmpIpAddress object to a 
 printable string. | 
 java.lang.String | 
toTagString()
 
          To convert the value of this SnmpIpAddress object to a printable 
 string where the type is tagged before the value with a tag 
 IpAddress:. | 
 java.lang.Object | 
toValue()
 
          Returns the value of this SnmpIpAddress as a String object. | 
 
 
 
| Methods inherited from class java.lang.Object | 
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
 
SnmpIpAddress
public SnmpIpAddress(java.lang.String s)
- Constructs a new SnmpIpAddress with the specified host name 
 or IP address as a string.
 This does not throw any exceptions. To ensure that a valid IpAddress
 is created, always try to use a dotted format ip address.
 Supplying host name to this constructor could result in delays
 caused by DNS lookups and in case a failure occurs then the toValue
 will return a null. If a 'null' parameter is passed as an argument
 to this constructor, then the object will be initialized with the 
 IP-address "0.0.0.0".
- Parameters:
 s - host name or IP address as a string.
 
 
SnmpIpAddress
public SnmpIpAddress(byte[] b)
- Constructs a new SnmpIpAddress by accepting the raw 
 IP address - 4 bytes.
- Parameters:
 b - raw IP address - 4 bytes
 
 
getVarObject
public java.lang.Object getVarObject()
- Returns the values of this SnmpIpAddress as a printable 
 String object. This method is the same as toString() 
 Eg. Returns the IPAddress as x.x.x.x . Same as toString()
- Overrides:
 getVarObject in class SnmpString
 
- Returns:
 - the value of the SnmpIpAddress as a printable string 
 Object or 'null' in case of invalid IPAddress.
 
 
 
toValue
public java.lang.Object toValue()
- Returns the value of this SnmpIpAddress as a String object. 
 This does not return the string corresponding to the IPAddress
 ( that is returned by the toString method), but instead returns a
 4-char String representing the four bytes comprising an IPAddress.
- Overrides:
 toValue in class SnmpString
 
- Returns:
 - String Object
             Null if IPAddress is invalid. This happens only if 
             object has been initialised with a wrong host name.
             This does not return the string corresponding to the
             IPAddress ( that is returned by the toString method), but
             instead returns a 4-char String representing the four bytes
             comprising an ipaddress.
 - See Also: 
 SnmpString.toValue(), 
SnmpIpAddress(java.lang.String)
 
 
toString
public java.lang.String toString()
- To convert the value of this SnmpIpAddress object to a 
 printable string. This returns the dotted ipaddress string always.
- Overrides:
 toString in class SnmpString
 
- Returns:
 - the value of this SnmpIpAddress as a printable string Object, 
 or 'null' in case of invalid IPAddress.
 
 
 
toTagString
public java.lang.String toTagString()
- To convert the value of this SnmpIpAddress object to a printable 
 string where the type is tagged before the value with a tag 
 IpAddress:. For e.g if the SnmpIpAddress has the value 127.0.0.1,
 then this method will return - IpAddress: 127.0.0.1 .
- Overrides:
 toTagString in class SnmpString
 
- Returns:
 - the value of this SnmpIpAddress object as a printable 
 string where the type is tagged before the value with a tag - 
 IpAddress: .
 
 
 
toHostName
public java.lang.String toHostName()
- To convert the object to a host name. In case of UnknownHostName 
 or SecurityException, this will return the dotted ip address.
- Returns:
 - Host name
 
 
 
netbToString
public static java.lang.String netbToString(byte[] rawIpAddr)
- A converter from raw IP address (byte[]) to string. This takes the 
 IP address as a byte[] and returns as a string in the form x.x.x.x .
- Parameters:
 rawIpAddr - The IP Address as a byte[].- Returns:
 - The value of the IPAddress as a string in the form
 x.x.x.x .
 
 
 
Copyright (c)AdventNet Inc., 1996-2004