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.
As of x.26, the property `timestampLongConverters.includeZoneSuffixWhenZoneIsUTC` will be deprecated and UTC dates will always be written with a 'Z' suffix.
| Modifier and Type | Field and Description |
|---|---|
static String |
INCLUDE_ZONE_SUFFIX_WHEN_ZONE_IS_UTC_SYSTEM_PROPERTY
System property to specify whether to include the 'Z' suffix for UTC zone timestamps.
|
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(String zoneId,
TimeUnit timeUnit,
boolean includeZoneSuffixForUTC)
Deprecated.
|
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, asString, asText, asText, forSymbols, lengthCheck, maxParseLength, maxParseLengthpublic static final ZoneId UTC
public static final String TIMESTAMP_LONG_CONVERTERS_ZONE_ID_SYSTEM_PROPERTY
public static final String INCLUDE_ZONE_SUFFIX_WHEN_ZONE_IS_UTC_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.
The flag for including zone suffix for UTC is fetched from the system property.zoneId - the zone ID to be used for the conversion of long valuestimeUnit - the time unit for the conversion of long values@Deprecated protected AbstractTimestampLongConverter(String zoneId, TimeUnit timeUnit, boolean includeZoneSuffixForUTC)
AbstractTimestampLongConverter with the specified zone ID, time unit and flag for including zone suffix for UTC.
This constructor is set to be deprecated in x.26 version.zoneId - the zone ID to be used for the conversion of long valuestimeUnit - the time unit for the conversion of long valuesincludeZoneSuffixForUTC - the flag to indicate if 'Z' suffix should be included for UTC zone timestampspublic 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 © 2023. All rights reserved.