public class CosemDate extends java.lang.Object implements CosemDateFormat
CosemDateFormat.Field
Modifier and Type | Field and Description |
---|---|
protected static int |
SIZE |
Constructor and Description |
---|
CosemDate(int year,
int month,
int dayOfMonth)
Constructs a COSEM Date.
|
CosemDate(int year,
int month,
int dayOfMonth,
int dayOfWeek)
Constructs a COSEM Date.
|
Modifier and Type | Method and Description |
---|---|
static CosemDate |
decode(byte[] octetString) |
byte[] |
encode()
The octet string.
|
int |
length()
The size of the octet string.
|
java.util.Calendar |
toCalendar()
Converts the COSEM DATE/TIME to a
Calendar . |
int |
valueFor(CosemDateFormat.Field field)
Retrieves the value for a certain value.
|
protected static final int SIZE
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, 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(byte[] octetString)
public byte[] encode()
CosemDateFormat
encode
in interface CosemDateFormat
public java.util.Calendar toCalendar()
CosemDateFormat
Calendar
.toCalendar
in interface CosemDateFormat
public int length()
CosemDateFormat
length
in interface CosemDateFormat
public int valueFor(CosemDateFormat.Field field)
CosemDateFormat
valueFor
in interface CosemDateFormat
field
- the field which should be retrieved.