com.tivoli.twg.snmputils
Class TimeticksVbl

java.lang.Object
  extended bycom.tivoli.twg.snmputils.VariableBinding
      extended bycom.tivoli.twg.snmputils.TimeticksVbl

public class TimeticksVbl
extends VariableBinding

Timeticks variable binding.


Field Summary
static long MAX_VALUE
           
static long MIN_VALUE
           
 
Fields inherited from class com.tivoli.twg.snmputils.VariableBinding
oid
 
Constructor Summary
TimeticksVbl(java.lang.String oid, java.util.Date valueDate)
          Constructor using object type for value
TimeticksVbl(java.lang.String oid, long value)
          Constructor using primitive type for value
 
Method Summary
 void addToPdu(SNMPPDU pdu)
          Adds the variable binding to the specified PDU
static java.lang.String formatTimeValue(long timeValue)
          Formats a time ticks value into a more readable string.
static java.util.Date getDateInstance(long timeValue)
          Takes a Timeticks value as input and returns the equivalent as a Date using the default time zone.
static int getMIBType()
          Describes the type of MIB I represent.
static int getType()
          Describes the type of variable binding I represent.
 long getValue()
          Returns the value for this variable binding as a primitive
 java.lang.Object getValueAsObject()
          Returns the value for this variable binding as an Object
 int size()
          Returns the size of the variable binding
 
Methods inherited from class com.tivoli.twg.snmputils.VariableBinding
getOid, setOid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_VALUE

public static final long MIN_VALUE
See Also:
Constant Field Values

MAX_VALUE

public static final long MAX_VALUE
See Also:
Constant Field Values
Constructor Detail

TimeticksVbl

public TimeticksVbl(java.lang.String oid,
                    long value)
             throws java.lang.NumberFormatException
Constructor using primitive type for value

Parameters:
oid - string for the OID of this variable binding
value - a long to create a VariableBinding for
Throws:
java.lang.NumberFormatException - if value not in range

TimeticksVbl

public TimeticksVbl(java.lang.String oid,
                    java.util.Date valueDate)
             throws java.lang.NumberFormatException
Constructor using object type for value

Parameters:
oid - string for the OID of this variable binding
valueDate - a Date object to create a value for
Throws:
java.lang.NumberFormatException - if value not in range
Method Detail

getType

public static int getType()
Describes the type of variable binding I represent.

Returns:
SNMP_SYNTAX_TIMETICKS
See Also:
SNMPPDU

getMIBType

public static int getMIBType()
Describes the type of MIB I represent.

Returns:
TWGMIBItem2.TYPE_TIMETICKS
See Also:
TWGMIBItem2

getValue

public long getValue()
Returns the value for this variable binding as a primitive

Returns:
variable binding value as a primitive type

getValueAsObject

public java.lang.Object getValueAsObject()
Returns the value for this variable binding as an Object

Specified by:
getValueAsObject in class VariableBinding
Returns:
variable binding value as an Object

addToPdu

public void addToPdu(SNMPPDU pdu)
Adds the variable binding to the specified PDU

Specified by:
addToPdu in class VariableBinding
Parameters:
pdu - SNMPPDU to add variable binding to

size

public int size()
Returns the size of the variable binding

Overrides:
size in class VariableBinding
Returns:
size of the variable binding
See Also:
VariableBinding

getDateInstance

public static java.util.Date getDateInstance(long timeValue)
Takes a Timeticks value as input and returns the equivalent as a Date using the default time zone. Note that the time value is in deci-seconds.

Parameters:
timeValue - long value (in deci-seconds to convert to date object
Returns:
Date object for this time value

formatTimeValue

public static java.lang.String formatTimeValue(long timeValue)
Formats a time ticks value into a more readable string. The output will look like: 2 days 21 hours 41 minutse 8 seconds (25086826)

Parameters:
timeValue - long value to format
Returns:
formatted string