Class FixedDateFormat
java.lang.Object
org.apache.logging.log4j.core.util.datetime.FixedDateFormat
Deprecated.
Custom time formatter that trades flexibility for performance. This formatter only supports the date patterns defined
in
FixedDateFormat.FixedFormat. For any other date patterns use FastDateFormat.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDeprecated.Enumeration over the supported date/time format patterns.static enumDeprecated.Fixed time zone formats. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate char[]Deprecated.private intDeprecated.private final int[]Deprecated.private final FastDateFormatDeprecated.private final FixedDateFormat.FixedFormatDeprecated.private final FixedDateFormat.FixedTimeZoneFormatDeprecated.private final intDeprecated.private longDeprecated.private longDeprecated.private final charDeprecated.private final intDeprecated.private static final charDeprecated.private final intDeprecated.(package private) static int[]Deprecated.private final charDeprecated.private final intDeprecated.private final TimeZoneDeprecated. -
Constructor Summary
ConstructorsConstructorDescriptionFixedDateFormat(FixedDateFormat.FixedFormat fixedFormat, TimeZone tz) Deprecated.Constructs a FixedDateFormat for the specified fixed format.FixedDateFormat(FixedDateFormat.FixedFormat fixedFormat, TimeZone tz, int secondFractionDigits) Deprecated.Constructs a FixedDateFormat for the specified fixed format. -
Method Summary
Modifier and TypeMethodDescriptionprivate longcalcMidnightMillis(long time, int addDays) Deprecated.static FixedDateFormatcreate(FixedDateFormat.FixedFormat format) Deprecated.Returns a newFixedDateFormatobject for the specifiedFixedFormatand aTimeZone.getDefault()TimeZone.static FixedDateFormatcreate(FixedDateFormat.FixedFormat format, TimeZone tz) Deprecated.Returns a newFixedDateFormatobject for the specifiedFixedFormatand TimeZone.static FixedDateFormatcreateIfSupported(String... options) Deprecated.private intdaylightSavingTime(int hourOfDay) Deprecated.private intDeprecated.format(long epochMillis) Deprecated.intformat(long epochMillis, char[] buffer, int startPos) Deprecated.formatInstant(Instant instant) Deprecated.intformatInstant(Instant instant, char[] buffer, int startPos) Deprecated.private intformatNanoOfMillisecond(int nanoOfMillisecond, char[] buffer, int pos) Deprecated.Deprecated.Returns the full pattern of the selected fixed format.final intDeprecated.Returns the length of the resulting formatted date and time strings.Deprecated.Returns the time zone.booleanisEquivalent(long oldEpochSecond, int oldNanoOfSecond, long epochSecond, int nanoOfSecond) Deprecated.Returnstrueif the old and new date values will result in the same formatted output,falseif results may differ.longmillisSinceMidnight(long currentTime) Deprecated.Returns the number of milliseconds since midnight in the time zone that thisFixedDateFormatwas constructed with for the specified currentTime.private voidupdateCachedDate(long now) Deprecated.private voidDeprecated.private voidupdateMidnightMillis(long now) Deprecated.private voidwriteDate(char[] buffer, int startPos) Deprecated.private intwriteTime(int ms, char[] buffer, int pos) Deprecated.private intwriteTimeZone(long epochMillis, char[] buffer, int pos) Deprecated.
-
Field Details
-
NONE
private static final char NONEDeprecated.- See Also:
-
fixedFormat
Deprecated. -
timeZone
Deprecated. -
length
private final int lengthDeprecated. -
secondFractionDigits
private final int secondFractionDigitsDeprecated. -
fastDateFormat
Deprecated. -
timeSeparatorChar
private final char timeSeparatorCharDeprecated. -
millisSeparatorChar
private final char millisSeparatorCharDeprecated. -
timeSeparatorLength
private final int timeSeparatorLengthDeprecated. -
millisSeparatorLength
private final int millisSeparatorLengthDeprecated. -
fixedTimeZoneFormat
Deprecated. -
midnightToday
private volatile long midnightTodayDeprecated. -
midnightTomorrow
private volatile long midnightTomorrowDeprecated. -
dstOffsets
private final int[] dstOffsetsDeprecated. -
cachedDate
private char[] cachedDateDeprecated. -
dateLength
private int dateLengthDeprecated. -
TABLE
static int[] TABLEDeprecated.
-
-
Constructor Details
-
FixedDateFormat
FixedDateFormat(FixedDateFormat.FixedFormat fixedFormat, TimeZone tz) Deprecated.Constructs a FixedDateFormat for the specified fixed format.Package protected for unit tests.
- Parameters:
fixedFormat- the fixed formattz- time zone
-
FixedDateFormat
FixedDateFormat(FixedDateFormat.FixedFormat fixedFormat, TimeZone tz, int secondFractionDigits) Deprecated.Constructs a FixedDateFormat for the specified fixed format.Package protected for unit tests.
- Parameters:
fixedFormat- the fixed formattz- time zonesecondFractionDigits- the number of digits specifying the fraction of the second to show
-
-
Method Details
-
createIfSupported
Deprecated. -
create
Deprecated.Returns a newFixedDateFormatobject for the specifiedFixedFormatand aTimeZone.getDefault()TimeZone.- Parameters:
format- the format to use- Returns:
- a new
FixedDateFormatobject
-
create
Deprecated.Returns a newFixedDateFormatobject for the specifiedFixedFormatand TimeZone.- Parameters:
format- the format to usetz- the time zone to use- Returns:
- a new
FixedDateFormatobject
-
getFormat
Deprecated.Returns the full pattern of the selected fixed format.- Returns:
- the full date-time pattern
-
getLength
public final int getLength()Deprecated.Returns the length of the resulting formatted date and time strings.- Returns:
- the length of the resulting formatted date and time strings
-
getTimeZone
-
millisSinceMidnight
public long millisSinceMidnight(long currentTime) Deprecated.Returns the number of milliseconds since midnight in the time zone that this
FixedDateFormatwas constructed with for the specified currentTime.As a side effect, this method updates the cached formatted date and the cached date demarcation timestamps when the specified current time is outside the previously set demarcation timestamps for the start or end of the current day.
- Parameters:
currentTime- the current time in millis since the epoch- Returns:
- the number of milliseconds since midnight for the specified time
-
updateMidnightMillis
private void updateMidnightMillis(long now) Deprecated. -
calcMidnightMillis
private long calcMidnightMillis(long time, int addDays) Deprecated. -
updateDaylightSavingTime
private void updateDaylightSavingTime()Deprecated. -
updateCachedDate
private void updateCachedDate(long now) Deprecated. -
formatInstant
-
formatInstant
Deprecated. -
digitsLessThanThree
private int digitsLessThanThree()Deprecated. -
format
Deprecated. -
format
public int format(long epochMillis, char[] buffer, int startPos) Deprecated. -
writeDate
private void writeDate(char[] buffer, int startPos) Deprecated. -
writeTime
private int writeTime(int ms, char[] buffer, int pos) Deprecated. -
writeTimeZone
private int writeTimeZone(long epochMillis, char[] buffer, int pos) Deprecated. -
formatNanoOfMillisecond
private int formatNanoOfMillisecond(int nanoOfMillisecond, char[] buffer, int pos) Deprecated. -
daylightSavingTime
private int daylightSavingTime(int hourOfDay) Deprecated. -
isEquivalent
public boolean isEquivalent(long oldEpochSecond, int oldNanoOfSecond, long epochSecond, int nanoOfSecond) Deprecated.Returnstrueif the old and new date values will result in the same formatted output,falseif results may differ.
-
2.25.0, this class is assumed to be internal and planned to be removed in the next major release.