com.sun.jaw.snmp.common
Class SnmpIpAddress

java.lang.Object
  |
  +--com.sun.jaw.snmp.common.SnmpValue
        |
        +--com.sun.jaw.snmp.common.SnmpOid
              |
              +--com.sun.jaw.snmp.common.SnmpIpAddress

public class SnmpIpAddress
extends SnmpOid

The SnmpIpAddress class represents an SNMP IpAddress.

See Also:
Serialized Form

Fields inherited from class com.sun.jaw.snmp.common.SnmpOid
componentCount, components, meta
 
Constructor Summary
SnmpIpAddress(byte[] bytes)
          Constructs a new SnmpIpAddress from the specified bytes array.
SnmpIpAddress(long addr)
          Constructs a new SnmpIpAddress from the specified long value.
SnmpIpAddress(long b1, long b2, long b3, long b4)
          Constructs a new SnmpIpAddress from four long values.
SnmpIpAddress(java.lang.String dotAddress)
          Constructs a new SnmpIpAddress from a dot-formatted String.
 
Method Summary
static void appendToOid(SnmpOid source, SnmpOid dest)
          Appends an SnmpOid representing an SnmpIpAddress to another oid.
 byte[] byteValue()
          Converts the address value to its byte array form.
 java.lang.String getTypeName()
          Returns a textual description of the type object.
static int nextOid(long[] index, int start)
          Scans an index oid, skip the address value and returns the position of the next value.
 java.lang.String stringValue()
          Converts the address to its String form.
static SnmpOid toOid(long[] index, int start)
          Extracts the ip address from an index oid and returns its value converted as an SnmpOid.
 
Methods inherited from class com.sun.jaw.snmp.common.SnmpOid
addToOid, addToOid, append, append, clone, compareTo, duplicate, enlargeIfNeeded, equals, getLength, hashCode, insert, insert, isValid, longValue, resolveVarName, toBoolean, toByte, toInteger, toLong, toOid, toString
 
Methods inherited from class com.sun.jaw.snmp.common.SnmpValue
toAsn1String
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SnmpIpAddress

public SnmpIpAddress(byte[] bytes)
              throws java.lang.IllegalArgumentException
Constructs a new SnmpIpAddress from the specified bytes array.
Parameters:
bytes - The four bytes composing the address.
Throws:
java.lang.IllegalArgumentException - The length of the array is not equal to four.

SnmpIpAddress

public SnmpIpAddress(long addr)
Constructs a new SnmpIpAddress from the specified long value.
Parameters:
addr - The initialization value.

SnmpIpAddress

public SnmpIpAddress(java.lang.String dotAddress)
              throws java.lang.IllegalArgumentException
Constructs a new SnmpIpAddress from a dot-formatted String. The dot-formatted String is like x.x.x.x .
Parameters:
dotAddress - The initialization value.
Throws:
java.lang.IllegalArgumentException - The string does not correspond to an ip address.

SnmpIpAddress

public SnmpIpAddress(long b1,
                     long b2,
                     long b3,
                     long b4)
Constructs a new SnmpIpAddress from four long values.
Parameters:
b1 - Byte 1.
b2 - Byte 2.
b3 - Byte 3.
b4 - Byte 4.
Throws:
java.lang.IllegalArgumentException - A value is outside of [0-255].
Method Detail

byteValue

public byte[] byteValue()
Converts the address value to its byte array form.
Returns:
The byte array representation of the value.

stringValue

public java.lang.String stringValue()
Converts the address to its String form. Same as toString(). Exists only to follow a naming scheme.
Returns:
The String representation of the value.

toOid

public static SnmpOid toOid(long[] index,
                            int start)
                     throws SnmpStatusException
Extracts the ip address from an index oid and returns its value converted as an SnmpOid.
Parameters:
index - The index array.
start - The position in the index array.
Returns:
The oid representing the ip address value.
Throws:
SnmpStatusException - There is no ip address value available at start position.

nextOid

public static int nextOid(long[] index,
                          int start)
                   throws SnmpStatusException
Scans an index oid, skip the address value and returns the position of the next value.
Parameters:
index - The index array.
start - The position in the index array.
Returns:
The position of the next value.
Throws:
SnmpStatusException - There is no address value available at start position.

appendToOid

public static void appendToOid(SnmpOid source,
                               SnmpOid dest)
Appends an SnmpOid representing an SnmpIpAddress to another oid.
Parameters:
source - An oid representing an SnmpIpAddress value.
dest - Where source should be appened.

getTypeName

public final java.lang.String getTypeName()
Returns a textual description of the type object.
Returns:
ASN.1 textual description.
Overrides:
getTypeName in class SnmpOid