|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mulgara.util.LexicalDateTime
public class LexicalDateTime
This class represents a dateTime value, preserving its lexical representation exactly. It stores the value of the dateTime in the canonical form, but also contains values which allow the preservation of the non-canonical format.
| Constructor Summary | |
|---|---|
LexicalDateTime(long millis)
Convenience constructor which allows easy construction of a LexicalDateTime using the milliseconds since the epoch. |
|
LexicalDateTime(long millis,
int tzHours,
int tzMinutes,
boolean isMidnight,
byte milliPlaces,
boolean isLocalTz,
boolean isZulu)
This constructor is used to set each field explicitly, when all such information is available. |
|
| Method Summary | |
|---|---|
static LexicalDateTime |
decode(ByteBuffer bb)
Decodes a ByteBuffer into a LexicalDateTime. |
static LexicalDateTime |
decode(long millis,
byte timezoneState,
byte places)
Decodes a millisecond value and an encoded byte into a timezone and flags. |
ByteBuffer |
encode(ByteBuffer bb)
Fills in a ByteBuffer with the data required to encode this object. |
byte |
encodeTimezoneState()
Creates a byte code for the timezone and flags of this dateTime. |
boolean |
equals(Object o)
|
byte |
getDecimalPlaces()
Gets the number of decimal places to represent the fraction of a second. |
long |
getMillis()
Gets the number of milliseconds since the epoch. |
int |
getTZHour()
The the hour part of the offset for the timezone. |
long |
getTZMinute()
The the minute part of the offset for the timezone. |
int |
hashCode()
|
boolean |
isLocal()
Gets the flag that indicates no timezone is present, and the local default should be used. |
boolean |
isMidnight()
Gets the flag that indicates that this time is a non-canonical form of midnight. |
boolean |
isZulu()
Gets the flag that indicates the Zulu timezone (UTC) and representation. |
static LexicalDateTime |
parseDateTime(String dt)
Parse a dateTime string. |
static int |
requiredBufferSize()
Get the size of buffer in bytes required to store this object |
String |
toString()
Return a lexical representation of this dateTime. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public LexicalDateTime(long millis,
int tzHours,
int tzMinutes,
boolean isMidnight,
byte milliPlaces,
boolean isLocalTz,
boolean isZulu)
isMidnight is set, then millis must be a multiple of 24 hours.isLocalTz is set, then tzHours and tzMinutes should be 0,
and isZulu must be false.isZulu is set, then tzHours and tzMinutes must be 0.millis % 10^(6 - milliPlaces) == 0
millis - The milliseconds since the epoch.tzHours - The hour offset for the timezone.tzMinutes - The minute offset for the timezone.isMidnight - If the non-canonical form for midnight is used. "24:00:00"milliPlaces - The number of decimal places used for representing millisecds as fractions of a second.isLocalTz - Indicates no timezone information, so use the local default.isZulu - Indicates that the timezone is "Zulu". This is equivalent to 00:00 and is represented as "Z".
IllegalArgumentException - if the isZulu flag conflicts with the timezone values or the offsets.public LexicalDateTime(long millis)
millis - Milliseconds since the epoch.| Method Detail |
|---|
public long getMillis()
public int getTZHour()
public long getTZMinute()
public boolean isMidnight()
public boolean isLocal()
public boolean isZulu()
public byte getDecimalPlaces()
public static int requiredBufferSize()
public ByteBuffer encode(ByteBuffer bb)
bb - The ByteBuffer to populate.
public byte encodeTimezoneState()
| bits 7-2 | timezone code |
| bit 1 | local flag |
| bit 0 | midnight flag |
public static LexicalDateTime decode(ByteBuffer bb)
ByteBuffer into a LexicalDateTime.
bb - The ByteBuffer to decode.
public static LexicalDateTime decode(long millis,
byte timezoneState,
byte places)
millis - The milliseconds since the epoch.timezoneState - The encoded data representing the timezone.places - The number of decimal places for the seconds representation.
public String toString()
toString in class Object
public static LexicalDateTime parseDateTime(String dt)
throws ParseException
dt - The dateTime string to parse.
ParseException - If a character that doesn't match the above pattern is discovered.public boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||