java.lang.Object
org.snmp4j.smi.AbstractVariable
org.snmp4j.smi.UnsignedInteger32
org.snmp4j.smi.TimeTicks
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<Variable>
,BERSerializable
,AssignableFromLong
,AssignableFromString
,Variable
The
TimeTicks
class represents the time in 1/100 seconds since some epoch (which should be have been
defined in the corresponding MIB specification).- Version:
- 1.7
- Author:
- Frank Fock
- See Also:
-
Field Summary
Fields inherited from class org.snmp4j.smi.UnsignedInteger32
value
Fields inherited from class org.snmp4j.smi.AbstractVariable
SMISYNTAXES_PROPERTIES
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Clones this variable.void
decodeBER
(BERInputStream inputStream) Decodes aVariable
from anBERInputStream
.void
Encodes aVariable
to anOutputStream
.void
fromMilliseconds
(long millis) Sets the timeticks value by milliseconds.int
Gets the ASN.1 syntax identifier value of this SNMP variable.final void
Sets the value of this TimeTicks instance from a string.long
Returns the timeticks value as milliseconds (instead 1/100 seconds).toString()
Returns string with the value of thisTimeTicks
object as "[days,]hh:mm:ss.hh".Formats the content of thisTimeTicks
object according to a suppliedMessageFormat
pattern.Methods inherited from class org.snmp4j.smi.UnsignedInteger32
compareTo, equals, fromSubIndex, getBERLength, getBERLengthFromValue, getValue, hashCode, setValue, toInt, toLong, toSubIndex
Methods inherited from class org.snmp4j.smi.AbstractVariable
createFromBER, createFromSyntax, equal, getBERPayloadLength, getSyntaxFromString, getSyntaxString, getSyntaxString, isDynamic, isException
-
Constructor Details
-
TimeTicks
public TimeTicks() -
TimeTicks
Copy constructor.- Parameters:
other
- a TimeTicks instance.- Since:
- 1.7
-
TimeTicks
public TimeTicks(long value)
-
-
Method Details
-
clone
Description copied from interface:Variable
Clones this variable. Cloning can be used by the SNMP4J API to better support concurrency by creating a clone for internal processing. The content of this object is independent to the content of the clone. Thus, changes to the clone will have no effect to this object.- Specified by:
clone
in interfaceVariable
- Overrides:
clone
in classUnsignedInteger32
- Returns:
- a new instance of this
Variable
with the same value.
-
getSyntax
public int getSyntax()Description copied from class:AbstractVariable
Gets the ASN.1 syntax identifier value of this SNMP variable.- Specified by:
getSyntax
in interfaceVariable
- Overrides:
getSyntax
in classUnsignedInteger32
- Returns:
- an integer value less than 128 for regular SMI objects and a value greater or equal than 128 for exception values like noSuchObject, noSuchInstance, and endOfMibView.
-
encodeBER
Description copied from class:AbstractVariable
Encodes aVariable
to anOutputStream
.- Specified by:
encodeBER
in interfaceBERSerializable
- Overrides:
encodeBER
in classUnsignedInteger32
- Parameters:
os
- anOutputStream
.- Throws:
IOException
- if an error occurs while writing to the stream.
-
decodeBER
Description copied from class:AbstractVariable
Decodes aVariable
from anBERInputStream
.- Specified by:
decodeBER
in interfaceBERSerializable
- Overrides:
decodeBER
in classUnsignedInteger32
- Parameters:
inputStream
- anBERInputStream
containing a BER encoded byte stream.- Throws:
IOException
- if the stream could not be decoded by using BER rules.
-
toString
Returns string with the value of thisTimeTicks
object as "[days,]hh:mm:ss.hh".- Specified by:
toString
in interfaceVariable
- Overrides:
toString
in classUnsignedInteger32
- Returns:
- a
String
representation of this object.
-
setValue
Sets the value of this TimeTicks instance from a string.- Specified by:
setValue
in interfaceAssignableFromString
- Overrides:
setValue
in classUnsignedInteger32
- Parameters:
value
- a string representation of this value, which is (a) is either an unsigned number or (b) matches the formatFORMAT_PATTERN
.- Since:
- 2.1.2
-
toString
Formats the content of thisTimeTicks
object according to a suppliedMessageFormat
pattern.- Parameters:
pattern
- aMessageFormat
pattern that takes up to five parameters which are: days, hours, minutes, seconds, and 1/100 seconds.- Returns:
- the formatted string representation.
-
toMilliseconds
public long toMilliseconds()Returns the timeticks value as milliseconds (instead 1/100 seconds).- Returns:
getValue()*10
.- Since:
- 1.7
-
fromMilliseconds
public void fromMilliseconds(long millis) Sets the timeticks value by milliseconds.- Parameters:
millis
- sets the value assetValue(millis/10)
.- Since:
- 1.7
-