- java.lang.Object
-
- org.snmp4j.smi.AbstractVariable
-
- org.snmp4j.smi.UnsignedInteger32
-
- org.snmp4j.smi.TimeTicks
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.lang.Comparable<Variable>,BERSerializable,AssignableFromLong,AssignableFromString,Variable
public class TimeTicks extends UnsignedInteger32
TheTimeTicksclass 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:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.snmp4j.smi.AbstractVariable
SMISYNTAXES_PROPERTIES
-
Fields inherited from class org.snmp4j.smi.UnsignedInteger32
value
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()Clones this variable.voiddecodeBER(BERInputStream inputStream)Decodes aVariablefrom anBERInputStream.voidencodeBER(java.io.OutputStream os)Encodes aVariableto anOutputStream.voidfromMilliseconds(long millis)Sets the timeticks value by milliseconds.intgetSyntax()Gets the ASN.1 syntax identifier value of this SNMP variable.voidsetValue(java.lang.String value)Sets the value of this TimeTicks instance from a string.longtoMilliseconds()Returns the timeticks value as milliseconds (instead 1/100 seconds).java.lang.StringtoString()Returns string with the value of thisTimeTicksobject as "[days,]hh:mm:ss.hh".java.lang.StringtoString(java.lang.String pattern)Formats the content of thisTimeTicksobject according to a suppliedMessageFormatpattern.-
Methods inherited from class org.snmp4j.smi.AbstractVariable
createFromBER, createFromSyntax, equal, getBERPayloadLength, getSyntaxFromString, getSyntaxString, getSyntaxString, isDynamic, isException
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from class org.snmp4j.smi.UnsignedInteger32
compareTo, equals, fromSubIndex, getBERLength, getBERLengthFromValue, getValue, hashCode, setValue, toInt, toLong, toSubIndex
-
-
-
-
Constructor Detail
-
TimeTicks
public TimeTicks()
-
TimeTicks
public TimeTicks(TimeTicks other)
Copy constructor.- Parameters:
other- a TimeTicks instance.- Since:
- 1.7
-
TimeTicks
public TimeTicks(long value)
-
-
Method Detail
-
clone
public java.lang.Object clone()
Description copied from interface:VariableClones 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:
clonein interfaceVariable- Overrides:
clonein classUnsignedInteger32- Returns:
- a new instance of this
Variablewith the same value.
-
getSyntax
public int getSyntax()
Description copied from class:AbstractVariableGets the ASN.1 syntax identifier value of this SNMP variable.- Specified by:
getSyntaxin interfaceVariable- Overrides:
getSyntaxin 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
public void encodeBER(java.io.OutputStream os) throws java.io.IOExceptionDescription copied from class:AbstractVariableEncodes aVariableto anOutputStream.- Specified by:
encodeBERin interfaceBERSerializable- Overrides:
encodeBERin classUnsignedInteger32- Parameters:
os- anOutputStream.- Throws:
java.io.IOException- if an error occurs while writing to the stream.
-
decodeBER
public void decodeBER(BERInputStream inputStream) throws java.io.IOException
Description copied from class:AbstractVariableDecodes aVariablefrom anBERInputStream.- Specified by:
decodeBERin interfaceBERSerializable- Overrides:
decodeBERin classUnsignedInteger32- Parameters:
inputStream- anBERInputStreamcontaining a BER encoded byte stream.- Throws:
java.io.IOException- if the stream could not be decoded by using BER rules.
-
toString
public java.lang.String toString()
Returns string with the value of thisTimeTicksobject as "[days,]hh:mm:ss.hh".- Specified by:
toStringin interfaceVariable- Overrides:
toStringin classUnsignedInteger32- Returns:
- a
Stringrepresentation of this object.
-
setValue
public final void setValue(java.lang.String value)
Sets the value of this TimeTicks instance from a string.- Specified by:
setValuein interfaceAssignableFromString- Overrides:
setValuein 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
public java.lang.String toString(java.lang.String pattern)
Formats the content of thisTimeTicksobject according to a suppliedMessageFormatpattern.- Parameters:
pattern- aMessageFormatpattern 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
-
-