public class CosemDate
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
CosemDate.Month |
CosemDateFormat.Field
Constructor and Description |
---|
CosemDate(int year,
CosemDate.Month month,
int dayOfMonth)
Constructs a COSEM Date.
|
CosemDate(int year,
int month,
int dayOfMonth)
Constructs a COSEM Date.
|
CosemDate(int year,
int month,
int dayOfMonth,
int dayOfWeek)
Constructs a COSEM Date.
|
CosemDate(long timestamp) |
Modifier and Type | Method and Description |
---|---|
long |
asUnixTimeStanp() |
static CosemDate |
decode(byte[] octetString) |
static CosemDate |
decode(java.io.InputStream stream) |
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.
|
java.util.Calendar |
toCalendar()
Converts the COSEM DATE/TIME to a
Calendar . |
public CosemDate(long timestamp)
public CosemDate(int year, int month, int dayOfMonth) throws java.lang.IllegalArgumentException
year
- the year from 0 to 0xffff.month
- the month from 1 to 12. Set to 0xff if not specified.dayOfMonth
- the day of the month starting from 1 to max 31. Set to 0xfe for the last day of a month and 0xfd for
the second last day of a month. Set to 0xff if not specified.java.lang.IllegalArgumentException
- if a parameter does not fit the rangepublic CosemDate(int year, CosemDate.Month month, int dayOfMonth) throws java.lang.IllegalArgumentException
year
- the year from 0 to 0xffff.month
- the monthdayOfMonth
- the day of the month starting from 1 to max 31. Set to 0xfe for the last day of a month and 0xfd for
the second last day of a month. Set to 0xff if not specified.java.lang.IllegalArgumentException
- if a parameter does not fit the rangepublic CosemDate(int year, int month, int dayOfMonth, int dayOfWeek) throws java.lang.IllegalArgumentException
year
- the year from 0 to 0xffff.month
- the month from 1 to 12. Set to 0xff if not specified.dayOfMonth
- the day of the month starting from 1 to max 31. Set to 0xfe for the last day of a month and 0xfd for
the second last day of a month. Set to 0xff if not specified.dayOfWeek
- the day of a week from 1 to 7. 1 is Monday. Set to 0xff if not specified or use
CosemDate(int, int, int)
java.lang.IllegalArgumentException
- if a parameter does not fit the rangepublic static CosemDate decode(java.io.InputStream stream) throws java.io.IOException
java.io.IOException
public static CosemDate decode(byte[] octetString)
public byte[] encode()
CosemDateFormat
public java.util.Calendar toCalendar()
CosemDateFormat
Calendar
.public int length()
CosemDateFormat
public int get(CosemDateFormat.Field field)
CosemDateFormat
field
- the field which should be retrieved.public long asUnixTimeStanp()
asUnixTimeStanp
in interface CosemDateFormat