HOME

com.ireasoning.protocol.snmp
Class SnmpIpAddress

java.lang.Object
  |
  +--com.ireasoning.protocol.snmp.SnmpOctetString
        |
        +--com.ireasoning.protocol.snmp.SnmpIpAddress
All Implemented Interfaces:
Msg, Serializable, SnmpDataType

public class SnmpIpAddress
extends SnmpOctetString

This class represents Snmp IpAddress data type. The IpAddress type represents a 32-bit internet address. It is represented as an OCTET STRING of length 4, in network byte-order.

See Also:
Serialized Form

Fields inherited from interface com.ireasoning.protocol.snmp.SnmpDataType
BITS, BITSTRING, COUNTER32, COUNTER64, END_OF_MIB_VIEW, END_OF_MIB_VIEW_OBJECT, GAUGE32, INTEGER, IPADDRESS, NO_SUCH_INSTANCE, NO_SUCH_INSTANCE_OBJECT, NO_SUCH_OBJECT, NO_SUCH_OBJECT_OBJECT, NULL, OCTETSTRING, OID, OPAQUE, PDU, SEQUENCE, SEQUENCEOF, TIMETICKS, UNSIGNED32, VARBIND
 
Fields inherited from interface com.ireasoning.protocol.Msg
ERROR_TYPE
 
Constructor Summary
SnmpIpAddress()
          Constructs a SnmpIpAddress whose ip address is 0.0.0.0
SnmpIpAddress(byte[] data)
          Constructs a SnmpIpAddress object with the passed in data
SnmpIpAddress(InetAddress ipAddr)
          Constructs a SnmpIpAddress with the passed in ipAddr object.
SnmpIpAddress(SnmpIpAddress ipAddr)
          Makes a copy of passed in ipAddr object
SnmpIpAddress(String ipAddr)
          Constructs a SnmpIpAddress with the passed in ipAddr object.
 
Method Summary
 SnmpDataType copy()
          Makes a copy of itself
 int encode(com.ireasoning.protocol.snmp.SnmpEncoder encoder)
          For internal use
 int getType()
          Returns SnmpDataType.IPADDRESS
 String getTypeString()
          Returns "IpAddress"
 InetAddress toInetAddress()
          Converts to InetAddress object
 String toString()
          Returns a String representation of this object.
 
Methods inherited from class com.ireasoning.protocol.snmp.SnmpOctetString
convertPhysAddress, equals, getBytes, getLength, getValue, hashCode, setValue, toHexString, toString2
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SnmpIpAddress

public SnmpIpAddress()
Constructs a SnmpIpAddress whose ip address is 0.0.0.0

SnmpIpAddress

public SnmpIpAddress(byte[] data)
Constructs a SnmpIpAddress object with the passed in data

SnmpIpAddress

public SnmpIpAddress(SnmpIpAddress ipAddr)
Makes a copy of passed in ipAddr object

SnmpIpAddress

public SnmpIpAddress(String ipAddr)
Constructs a SnmpIpAddress with the passed in ipAddr object. If passed ipAddr is null or an empty string, this class will represent it as 0.0.0.0
Throws:
IllegalArgumentException - raised if passed ipAddr is invalid

SnmpIpAddress

public SnmpIpAddress(InetAddress ipAddr)
Constructs a SnmpIpAddress with the passed in ipAddr object. If passed ipAddr is null or an empty string, this class will represent it as 0.0.0.0
Throws:
IllegalArgumentException - raised if passed ipAddr is invalid
Method Detail

getType

public int getType()
Returns SnmpDataType.IPADDRESS
Overrides:
getType in class SnmpOctetString
Following copied from interface: com.ireasoning.protocol.snmp.SnmpDataType
Returns:
the object data type

getTypeString

public String getTypeString()
Returns "IpAddress"
Overrides:
getTypeString in class SnmpOctetString

toString

public String toString()
Description copied from class: SnmpOctetString
Returns a String representation of this object. If this object contains a non-displayable character, it will be automatically switch to hex format, that is, result is the same as toHexString() method.
Overrides:
toString in class SnmpOctetString

toInetAddress

public InetAddress toInetAddress()
Converts to InetAddress object

copy

public SnmpDataType copy()
Description copied from interface: SnmpDataType
Makes a copy of itself
Overrides:
copy in class SnmpOctetString
Following copied from interface: com.ireasoning.protocol.snmp.SnmpDataType
Returns:
a deep copy of this object

encode

public int encode(com.ireasoning.protocol.snmp.SnmpEncoder encoder)
           throws SnmpEncodingException
Description copied from interface: SnmpDataType
For internal use
Overrides:
encode in class SnmpOctetString

HOME

Copyright © 2002 iReasoning Inc. All Rights Reserved.