Package org.openmuc.jdlms.datatypes
Class CosemTime
- java.lang.Object
-
- org.openmuc.jdlms.datatypes.CosemTime
-
- All Implemented Interfaces:
CosemDateFormat
public class CosemTime extends java.lang.Object implements CosemDateFormat
Class representing a COSEM Time.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.openmuc.jdlms.datatypes.CosemDateFormat
CosemDateFormat.Field
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CosemTime
decode(byte[] octetString)
static CosemTime
decode(java.io.InputStream inputStream)
byte[]
encode()
The octet string.int
get(CosemDateFormat.Field field)
Retrieves the value for a certain value.int
length()
The size of the octet string.
-
-
-
Constructor Detail
-
CosemTime
public CosemTime(int hour, int minute, int second)
Constructs a COSEM Time.- Parameters:
hour
- the hour from 0 to 23. 0xff if not specified.minute
- the minute from 0 to 59. 0xff if not specified.second
- the second from 0 to 59. 0xff if not specified.- Throws:
java.lang.IllegalArgumentException
- if a parameter does not fit the range
-
CosemTime
public CosemTime(int hour, int minute, int second, int hundredths) throws java.lang.IllegalArgumentException
Constructs a COSEM Time.- Parameters:
hour
- the hour from 0 to 23. 0xff if not specified.minute
- the minute from 0 to 59. 0xff if not specified.second
- the second from 0 to 59. 0xff if not specified.hundredths
- the hundredths seconds from 0 to 99. 0xff if not specified.- Throws:
java.lang.IllegalArgumentException
- if a parameter does not fit the range
-
-
Method Detail
-
decode
public static CosemTime decode(java.io.InputStream inputStream) throws java.io.IOException
- Throws:
java.io.IOException
-
decode
public static CosemTime decode(byte[] octetString)
-
encode
public byte[] encode()
Description copied from interface:CosemDateFormat
The octet string.- Specified by:
encode
in interfaceCosemDateFormat
- Returns:
- the octet string.
-
length
public int length()
Description copied from interface:CosemDateFormat
The size of the octet string.- Specified by:
length
in interfaceCosemDateFormat
- Returns:
- the size.
-
get
public int get(CosemDateFormat.Field field)
Description copied from interface:CosemDateFormat
Retrieves the value for a certain value.- Specified by:
get
in interfaceCosemDateFormat
- Parameters:
field
- the field which should be retrieved.- Returns:
- the value as an int32.
-
-