public class CosemDate extends java.lang.Object implements CosemDateFormat
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.
|
Modifier and Type | Method and Description |
---|---|
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(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
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 get(CosemDateFormat.Field field)
CosemDateFormat
get
in interface CosemDateFormat
field
- the field which should be retrieved.