com.sun.management.snmp
Class SnmpIpAddress

java.lang.Object
  extended by com.sun.management.snmp.SnmpValue
      extended by com.sun.management.snmp.SnmpOid
          extended by com.sun.management.snmp.SnmpIpAddress
All Implemented Interfaces:
SnmpDataTypeEnums, Serializable, Cloneable

public class SnmpIpAddress
extends SnmpOid

Represents an SNMP IpAddress.

Since:
Java DMK 5.1
See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.sun.management.snmp.SnmpOid
componentCount, components
 
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
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(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.
 String getTypeName()
          Returns a textual description of the type object.
static int nextOid(long[] index, int start)
          Scans an index OID, skips the address value and returns the position of the next value.
 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.management.snmp.SnmpOid
addToOid, addToOid, append, append, clone, compareTo, duplicate, equals, getLength, getOidArc, getSnmpOidTable, hashCode, insert, insert, isValid, longValue, longValue, resolveVarName, setSnmpOidTable, toBoolean, toByte, toInteger, toLong, toOctetString, toOid, toString, 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
 

Constructor Detail

SnmpIpAddress

public SnmpIpAddress(byte[] bytes)
              throws IllegalArgumentException
Constructs a new SnmpIpAddress from the specified bytes array.

Parameters:
bytes - The four bytes composing the address.
Throws:
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(String dotAddress)
              throws IllegalArgumentException
Constructs a new SnmpIpAddress from a dot-formatted String. The dot-formatted String is formulated x.x.x.x .

Parameters:
dotAddress - The initialization value.
Throws:
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:
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 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 the start position.

nextOid

public static int nextOid(long[] index,
                          int start)
                   throws SnmpStatusException
Scans an index OID, skips 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 the 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 appended.

getTypeName

public final String getTypeName()
Returns a textual description of the type object.

Overrides:
getTypeName in class SnmpOid
Returns:
ASN.1 textual description.

Open Source build 02
opendmk-1.0-b02 2007.10.01_19:17:46_MEST

Copyright 1998-2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.