public abstract class AbstractTimestampLongConverter extends Object implements LongConverter
All long values that are handled by this converter are assumed to be timestamps in UTC.
Parsing of ISO dates, with or without timestamps, is supported. If an ISO date is read with no timezone, it is assumed to be in the converter's zone.
| Modifier and Type | Field and Description |
|---|---|
static String |
TIMESTAMP_LONG_CONVERTERS_ZONE_ID_SYSTEM_PROPERTY
System property to specify the ZoneId for timestamp conversion.
|
static ZoneId |
UTC
Universal Time Coordinated (UTC) timezone
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractTimestampLongConverter(String zoneId,
TimeUnit timeUnit)
Constructs a new
AbstractTimestampLongConverter with the specified zone ID and time unit. |
protected |
AbstractTimestampLongConverter(TimeUnit timeUnit)
Constructs a new
AbstractTimestampLongConverter with the specified time unit. |
| Modifier and Type | Method and Description |
|---|---|
void |
append(Appendable text,
long value) |
void |
append(net.openhft.chronicle.bytes.Bytes<?> bytes,
long value)
Appends the provided long value to the given
Bytes. |
void |
append(StringBuilder text,
long value)
Appends the provided long value to the given
StringBuilder. |
protected abstract void |
appendFraction(DateTimeFormatterBuilder builder)
Appends the fraction of the second to the provided
DateTimeFormatterBuilder. |
long |
parse(CharSequence text)
Parses the provided text and converts it into a long timestamp.
|
protected abstract long |
parseFormattedDate(ZonedDateTime value)
Interpret formatted date
|
protected abstract long |
parseTimestamp(long value,
CharSequence text)
Interpret long timestamp
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddEncode, allSafeChars, allSafeChars, asString, asText, asText, forSymbols, lengthCheck, lengthCheck, maxParseLength, maxParseLength, parsepublic static final ZoneId UTC
public static final String TIMESTAMP_LONG_CONVERTERS_ZONE_ID_SYSTEM_PROPERTY
protected AbstractTimestampLongConverter(TimeUnit timeUnit)
AbstractTimestampLongConverter with the specified time unit.
The zone ID is fetched from the system property. If the system property is not set, UTC is used.timeUnit - the time unit for the conversion of long valuesprotected AbstractTimestampLongConverter(String zoneId, TimeUnit timeUnit)
AbstractTimestampLongConverter with the specified zone ID and time unit.zoneId - the zone ID to be used for the conversion of long valuestimeUnit - the time unit for the conversion of long valuespublic long parse(CharSequence text)
parse in interface LongConvertertext - the text to be parsedprotected abstract long parseFormattedDate(ZonedDateTime value)
value - The parsed formatted date (in UTC zone)protected abstract long parseTimestamp(long value,
CharSequence text)
value - The parsed timestampprotected abstract void appendFraction(DateTimeFormatterBuilder builder)
DateTimeFormatterBuilder.builder - The builder after the initial date format has been addedpublic void append(Appendable text, long value)
public void append(StringBuilder text, long value)
StringBuilder. This method delegates to append(Appendable, long).append in interface LongConvertertext - the StringBuilder to append tovalue - the long value to be appendedpublic void append(net.openhft.chronicle.bytes.Bytes<?> bytes,
long value)
Bytes. This method delegates to append(Appendable, long).append in interface LongConverterbytes - the Bytes to append tovalue - the long value to be appendedCopyright © 2024. All rights reserved.