@ThreadSafe public enum DateTimeConverter extends Enum<DateTimeConverter>
| Enum Constant and Description |
|---|
JAR
This instance applies the schedule for Daylight Saving Time (DST),
i.e. all time conversions will apply DST where appropriate to a
particular date.
|
ZIP
This instance ignores the schedule for Daylight Saving Time (DST),
i.e. all time conversions will use the same raw offset and current
DST savings, regardless of whether DST savings should be applied to
a particular date or not.
|
| Modifier and Type | Field and Description |
|---|---|
(package private) ThreadLocal<GregorianCalendar> |
calendar |
(package private) static long |
MAX_DOS_TIME
Largest supported DOS date/time value in a ZIP file,
which is December 31st, 2107 AD 23:59:58 local time.
|
(package private) static long |
MIN_DOS_TIME
Smallest supported DOS date/time value in a ZIP file,
which is January 1st, 1980 AD 00:00:00 local time.
|
| Modifier and Type | Method and Description |
|---|---|
(package private) abstract GregorianCalendar |
getThreadLocalCalendar()
Returns a thread local lenient gregorian calendar for date/time
conversion which has its timezone set according to the conventions of
the represented archive format.
|
(package private) abstract boolean |
roundUp(long jTime)
Returns whether the given Java time should be rounded up or down to the
next two second interval when converting it to a DOS date/time.
|
(package private) long |
toDosTime(long jtime)
Converts a Java time value to a DOS date/time value.
|
(package private) long |
toJavaTime(long dtime)
Converts a 32 bit integer encoded DOS date/time value to a Java time
value.
|
static DateTimeConverter |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static DateTimeConverter[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final DateTimeConverter JAR
This behaviour provides best interoperability with:
jar utility
and java.util.zip packageunzippublic static final DateTimeConverter ZIP
This behavior provides best interoperability with:
final ThreadLocal<GregorianCalendar> calendar
static final long MAX_DOS_TIME
static final long MIN_DOS_TIME
abstract GregorianCalendar getThreadLocalCalendar()
abstract boolean roundUp(long jTime)
jTime - The number of milliseconds since midnight, January 1st,
1970 AD UTC (called epoch alias Java time).true for round-up, false for round-down.final long toDosTime(long jtime)
If the given Java time value preceeds MIN_DOS_TIME,
then it's adjusted to this value.
If the given Java time value exceeds MAX_DOS_TIME,
then it's adjusted to this value.
The return value is rounded up or down to even seconds,
depending on roundUp(long).
jtime - The number of milliseconds since midnight, January 1st,
1970 AD UTC (called the epoch alias Java time).MIN_DOS_TIME and MAX_DOS_TIME.IllegalArgumentException - If jTime is negative.toJavaTime(long)final long toJavaTime(long dtime)
Note that not all 32 bit integers are valid DOS date/time values.
If an invalid DOS date/time value is provided, it gets adjusted by
overflowing the respective field value as if using a
lenient calendar.
If the given DOS date/time value preceeds MIN_DOS_TIME,
then it's adjusted to this value.
If the given DOS date/time value exceeds MAX_DOS_TIME,
then it's adjusted to this value.
These features are provided in order to read bogus ZIP archive files
created by third party tools.
Note that the returned Java time may differ from its intended value at
the time of the creation of the ZIP archive file and when converting
it back again, the resulting DOS date/time value will not be the same as
dTime.
This is because of the limited resolution of two seconds for DOS
data/time values.
dtime - The DOS date/time value.MIN_DOS_TIME and MAX_DOS_TIME.toDosTime(long)public static DateTimeConverter valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant
with the specified nameNullPointerException - if the argument is nullpublic static DateTimeConverter[] values()
for (DateTimeConverter c : DateTimeConverter.values()) System.out.println(c);
Copyright © 2005-2012 Schlichtherle IT Services. All Rights Reserved.