public class MilliTimestampLongConverter extends AbstractTimestampLongConverter
MilliTimestampLongConverter is an implementation of AbstractTimestampLongConverter
which handles conversions between long timestamps and date-time strings.
The precision of this converter is to the millisecond.
This converter is singleton, the instance can be accessed using the public field INSTANCE.| Modifier and Type | Field and Description |
|---|---|
static MilliTimestampLongConverter |
INSTANCE
The singleton instance of this converter.
|
TIMESTAMP_LONG_CONVERTERS_ZONE_ID_SYSTEM_PROPERTY, UTC| Constructor and Description |
|---|
MilliTimestampLongConverter()
Constructs a new
MilliTimestampLongConverter with the default zone ID (fetched from the system property or UTC). |
MilliTimestampLongConverter(String zoneId)
Constructs a new
MilliTimestampLongConverter with the specified zone ID. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
appendFraction(DateTimeFormatterBuilder builder)
Appends the fraction of the second to the provided
DateTimeFormatterBuilder. |
protected long |
parseFormattedDate(ZonedDateTime value)
Parses a formatted date into a long timestamp.
|
protected long |
parseTimestamp(long value,
CharSequence text)
Parses a long timestamp.
|
append, append, append, parseclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddEncode, allSafeChars, allSafeChars, asString, asText, asText, forSymbols, lengthCheck, lengthCheck, maxParseLength, maxParseLength, parsepublic static final MilliTimestampLongConverter INSTANCE
public MilliTimestampLongConverter()
MilliTimestampLongConverter with the default zone ID (fetched from the system property or UTC).public MilliTimestampLongConverter(String zoneId)
MilliTimestampLongConverter with the specified zone ID.zoneId - the zone ID to be used for the conversion of long valuesprotected long parseFormattedDate(ZonedDateTime value)
parseFormattedDate in class AbstractTimestampLongConvertervalue - The parsed formatted date (in UTC zone)protected long parseTimestamp(long value,
CharSequence text)
parseTimestamp in class AbstractTimestampLongConvertervalue - The parsed timestamptext - The text version of the timestampprotected void appendFraction(DateTimeFormatterBuilder builder)
DateTimeFormatterBuilder.
The fraction is defined in milliseconds and can be 0 to 3 digits long.appendFraction in class AbstractTimestampLongConverterbuilder - The builder after the initial date format has been addedCopyright © 2024. All rights reserved.