An extra field that stores additional file and directory timestamp data for ZIP entries. Each ZIP entry can include up to three timestamps (modify, access, create*). The timestamps are stored as 32 bit signed integers representing seconds since UNIX epoch (Jan 1st, 1970, UTC). This field improves on ZIP's default timestamp granularity, since it allows one to store additional timestamps, and, in addition, the timestamps are stored using per-second granularity (zip's default behavior can only store timestamps to the nearest even second).
Unfortunately, 32 (signed) bits can only store dates up to the year 2037, and so this extra field will eventually be obsolete. Enjoy it while it lasts!
We're using the field definition given in Info-Zip's source archive: zip-3.0.tar.gz/proginfo/extrafld.txt
Value Size Description
----- ---- -----------
0x5455 Short tag for this extra block type ("UT")
TSize Short total data size for this block
Flags Byte info bits
(ModTime) Long time of last modification (UTC/GMT)
(AcTime) Long time of last access (UTC/GMT)
(CrTime) Long time of original creation (UTC/GMT)
Central-header version:
Value Size Description
----- ---- -----------
0x5455 Short tag for this extra block type ("UT")
TSize Short total data size for this block
Flags Byte info bits (refers to local header!)
(ModTime) Long time of last modification (UTC/GMT)
| Modifier and Type | Field and Description |
|---|---|
| public static final byte | ACCESS_TIME_BIT
The bit set inside the flags by when the lasr access time is present in this extra field. |
| private ZipLong | |
| private boolean | |
| private boolean | |
| private boolean | |
| public static final byte | CREATE_TIME_BIT
The bit set inside the flags by when the original creation time is present in this extra field. |
| private ZipLong | |
| private byte | |
| public static final ZipShort | HEADER_ID
The header ID for this extra field. |
| public static final byte | MODIFY_TIME_BIT
The bit set inside the flags by when the last modification time is present in this extra field. |
| private ZipLong | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Object | |
| private static ZipLong | Returns: ZipLongjava.util.Date to convert to ZipLong d)Utility method converts java.util.Date (milliseconds since epoch) into a ZipLong (seconds since epoch). |
| public boolean | equals(final Object
the reference object with which to compare. o)Overrides java. |
| private static ZipLong | Returns: ZipLongFileTime to convert to ZipLongUtility method converts |
| public FileTime | Returns: modify time asFileTime or null.Gets the access time as a |
| public Date | Returns: access time as java.util.Date or null.Gets the access time as a java.util.Date of this ZIP entry, or null if no such timestamp exists in the ZIP entry. |
| public ZipLong | Returns: access time (seconds since epoch) or null.Gets the access time (seconds since epoch) of this ZIP entry as a ZipLong object, or null if no such timestamp exists in the ZIP entry. |
| public byte[] | Returns: the central directory dataImplements org. |
| public ZipShort | Returns: aZipShort for the length of the data of this extra fieldImplements org. |
| public FileTime | Returns: modify time asFileTime or null.Gets the create time as a |
| public Date | Returns: create time as java.util.Date or null.Gets the create time as a java.util.Date of this ZIP entry, or null if no such timestamp exists in the ZIP entry. |
| public ZipLong | Returns: create time (seconds since epoch) or null.Gets the create time (seconds since epoch) of this ZIP entry as a ZipLong object, or null if no such timestamp exists in the ZIP entry. |
| public byte | Returns: flags byte indicating which of the three datestamp fields are present.Gets flags byte. |
| public ZipShort | Returns: the value for the header id for this extrafieldImplements org. |
| public byte[] | Returns: get the dataImplements org. |
| public ZipShort | Returns: aZipShort for the length of the data of this extra fieldImplements org. |
| public FileTime | Returns: modify time asFileTime or null.Gets the modify time as a |
| public Date | Returns: modify time as java.util.Date or null.Gets the modify time as a java.util.Date of this ZIP entry, or null if no such timestamp exists in the ZIP entry. |
| public ZipLong | Returns: modify time (seconds since epoch) or null.Gets the modify time (seconds since epoch) of this ZIP entry as a ZipLong object, or null if no such timestamp exists in the ZIP entry. |
| public int | |
| public boolean | Returns: true if bit0 of the flags byte is set.Tests whether bit0 of the flags byte is set or not, which should correspond to the presence or absence of a modify timestamp in this particular ZIP entry. |
| public boolean | Returns: true if bit1 of the flags byte is set.Tests whether bit1 of the flags byte is set or not, which should correspond to the presence or absence of a "last access" timestamp in this particular ZIP entry. |
| public boolean | Returns: true if bit2 of the flags byte is set.Tests whether bit2 of the flags byte is set or not, which should correspond to the presence or absence of a create timestamp in this particular ZIP entry. |
| public void | parseFromCentralDirectoryData(final byte[]
the buffer to read data from buffer, final int offset into buffer to read data offset, final int the length of data length)Implements org. |
| public void | parseFromLocalFileData(final byte[]
an array of bytes data, int the start offset offset, final int the number of bytes in the array from offset length)Implements org. |
| private void | |
| public void | setAccessFileTime(final FileTime
access time as time)FileTime
Sets the acccess time as a |
| public void | setAccessJavaTime(final Date
access time as java.util.Date d)Sets the access time as a java.util.Date of this ZIP entry. |
| public void | setAccessTime(final ZipLong
ZipLong of the access time (seconds per epoch) l)Sets the access time (seconds since epoch) of this ZIP entry using a ZipLong object Note: the setters for flags and timestamps are decoupled. |
| public void | setCreateFileTime(final FileTime
create time as time)FileTime
Sets the create time as a |
| public void | setCreateJavaTime(final Date
create time as java.util.Date d)Sets the create time as a java.util.Date of this ZIP entry. |
| public void | setCreateTime(final ZipLong
ZipLong of the create time (seconds per epoch) l)Sets the create time (seconds since epoch) of this ZIP entry using a ZipLong object Note: the setters for flags and timestamps are decoupled. |
| public void | setFlags(final byte
flags byte indicating which of the three datestamp fields are present. flags)Sets flags byte. |
| public void | setModifyFileTime(final FileTime
modify time as time)FileTime
Sets the modify time as a |
| public void | setModifyJavaTime(final Date
modify time as java.util.Date d)Sets the modify time as a java.util.Date of this ZIP entry. |
| public void | setModifyTime(final ZipLong
ZipLong of the modify time (seconds per epoch) l)Sets the modify time (seconds since epoch) of this ZIP entry using a ZipLong object. |
| public String | Returns: A String representation of this class useful for debugging purposes.Overrides java. |
| private static FileTime | |
| private static ZipLong | |
| private static Date |
| ACCESS_TIME_BIT | back to summary |
|---|---|
| public static final byte ACCESS_TIME_BIT The bit set inside the flags by when the lasr access time is present in this extra field. | |
| accessTime | back to summary |
|---|---|
| private ZipLong accessTime | |
| bit0_modifyTimePresent | back to summary |
|---|---|
| private boolean bit0_modifyTimePresent | |
| bit1_accessTimePresent | back to summary |
|---|---|
| private boolean bit1_accessTimePresent | |
| bit2_createTimePresent | back to summary |
|---|---|
| private boolean bit2_createTimePresent | |
| CREATE_TIME_BIT | back to summary |
|---|---|
| public static final byte CREATE_TIME_BIT The bit set inside the flags by when the original creation time is present in this extra field. | |
| createTime | back to summary |
|---|---|
| private ZipLong createTime | |
| flags | back to summary |
|---|---|
| private byte flags | |
| HEADER_ID | back to summary |
|---|---|
| public static final ZipShort HEADER_ID The header ID for this extra field.
| |
| MODIFY_TIME_BIT | back to summary |
|---|---|
| public static final byte MODIFY_TIME_BIT The bit set inside the flags by when the last modification time is present in this extra field. | |
| modifyTime | back to summary |
|---|---|
| private ZipLong modifyTime | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| X5455_ExtendedTimestamp | back to summary |
|---|---|
| public X5455_ExtendedTimestamp() Constructor for X5455_ExtendedTimestamp. | |
| clone | back to summary |
|---|---|
| public Object clone() throws CloneNotSupportedException Overrides java. Doc from java. Creates and returns a copy of this object. The precise meaning
of "copy" may depend on the class of the object. The general
intent is that, for any object will be true, and that the expression:x.clone() != x will bex.clone().getClass() == x.getClass() true, but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x) true, this is not an absolute requirement.
By convention, the returned object should be obtained by calling
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by
| |
| dateToZipLong | back to summary |
|---|---|
| private static ZipLong dateToZipLong(final Date d) Utility method converts java.util.Date (milliseconds since epoch) into a ZipLong (seconds since epoch). Also makes sure the converted ZipLong is not too big to fit in 32 unsigned bits. | |
| equals | back to summary |
|---|---|
| public boolean equals(final Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| fileTimeToZipLong | back to summary |
|---|---|
| private static ZipLong fileTimeToZipLong(final FileTime time) Utility method converts Also makes sure the converted ZipLong is not too big to fit in 32 unsigned bits. | |
| getAccessFileTime | back to summary |
|---|---|
| public FileTime getAccessFileTime() Gets the access time as a | |
| getAccessJavaTime | back to summary |
|---|---|
| public Date getAccessJavaTime() Gets the access time as a java.util.Date of this ZIP entry, or null if no such timestamp exists in the ZIP entry. The milliseconds are always zeroed out, since the underlying data offers only per-second precision.
| |
| getAccessTime | back to summary |
|---|---|
| public ZipLong getAccessTime() Gets the access time (seconds since epoch) of this ZIP entry as a ZipLong object, or null if no such timestamp exists in the ZIP entry.
| |
| getCentralDirectoryData | back to summary |
|---|---|
| public byte[] getCentralDirectoryData() Implements org. Gets the actual data to put into central directory data - without Header-ID or length specifier.
| |
| getCentralDirectoryLength | back to summary |
|---|---|
| public ZipShort getCentralDirectoryLength() Implements org. Gets the length of the extra field in the local file data - without Header-ID or length specifier. For X5455 the central length is often smaller than the local length, because central cannot contain access or create timestamps. | |
| getCreateFileTime | back to summary |
|---|---|
| public FileTime getCreateFileTime() Gets the create time as a | |
| getCreateJavaTime | back to summary |
|---|---|
| public Date getCreateJavaTime() Gets the create time as a java.util.Date of this ZIP entry, or null if no such timestamp exists in the ZIP entry. The milliseconds are always zeroed out, since the underlying data offers only per-second precision. Note modern Linux file systems (e.g., ext2) do not appear to store a "create time" value, and so it's usually omitted altogether in the ZIP extra field. Perhaps other Unix systems track this.
| |
| getCreateTime | back to summary |
|---|---|
| public ZipLong getCreateTime() Gets the create time (seconds since epoch) of this ZIP entry as a ZipLong object, or null if no such timestamp exists in the ZIP entry. Note modern Linux file systems (e.g., ext2) do not appear to store a "create time" value, and so it's usually omitted altogether in the ZIP extra field. Perhaps other Unix systems track this.
| |
| getFlags | back to summary |
|---|---|
| public byte getFlags() Gets flags byte. The flags byte tells us which of the three datestamp fields are present in the data: bit0 - modify time bit1 - access time bit2 - create timeOnly first 3 bits of flags are used according to the latest version of the spec (December 2012).
| |
| getHeaderId | back to summary |
|---|---|
| public ZipShort getHeaderId() Implements org. Gets the Header-ID. | |
| getLocalFileDataData | back to summary |
|---|---|
| public byte[] getLocalFileDataData() Implements org. Gets the actual data to put into local file data - without Header-ID or length specifier.
| |
| getLocalFileDataLength | back to summary |
|---|---|
| public ZipShort getLocalFileDataLength() Implements org. Gets the length of the extra field in the local file data - without Header-ID or length specifier. | |
| getModifyFileTime | back to summary |
|---|---|
| public FileTime getModifyFileTime() Gets the modify time as a | |
| getModifyJavaTime | back to summary |
|---|---|
| public Date getModifyJavaTime() Gets the modify time as a java.util.Date of this ZIP entry, or null if no such timestamp exists in the ZIP entry. The milliseconds are always zeroed out, since the underlying data offers only per-second precision.
| |
| getModifyTime | back to summary |
|---|---|
| public ZipLong getModifyTime() Gets the modify time (seconds since epoch) of this ZIP entry as a ZipLong object, or null if no such timestamp exists in the ZIP entry.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| isBit0_modifyTimePresent | back to summary |
|---|---|
| public boolean isBit0_modifyTimePresent() Tests whether bit0 of the flags byte is set or not, which should correspond to the presence or absence of a modify timestamp in this particular ZIP entry.
| |
| isBit1_accessTimePresent | back to summary |
|---|---|
| public boolean isBit1_accessTimePresent() Tests whether bit1 of the flags byte is set or not, which should correspond to the presence or absence of a "last access" timestamp in this particular ZIP entry.
| |
| isBit2_createTimePresent | back to summary |
|---|---|
| public boolean isBit2_createTimePresent() Tests whether bit2 of the flags byte is set or not, which should correspond to the presence or absence of a create timestamp in this particular ZIP entry.
| |
| parseFromCentralDirectoryData | back to summary |
|---|---|
| public void parseFromCentralDirectoryData(final byte[] buffer, final int offset, final int length) throws ZipException Implements org. Doesn't do anything special since this class always uses the same parsing logic for both central directory and local file data.
| |
| parseFromLocalFileData | back to summary |
|---|---|
| public void parseFromLocalFileData(final byte[] data, int offset, final int length) throws ZipException Implements org. Populate data from this array as if it was in local file data.
| |
| reset | back to summary |
|---|---|
| private void reset() Reset state back to newly constructed state. Helps us make sure parse() calls always generate clean results. | |
| setAccessFileTime | back to summary |
|---|---|
| public void setAccessFileTime(final FileTime time)
Sets the acccess time as a Note the setters for flags and timestamps are decoupled. Even if the timestamp is not-null, it will only be written out if the corresponding bit in the flags is also set. | |
| setAccessJavaTime | back to summary |
|---|---|
| public void setAccessJavaTime(final Date d) Sets the access time as a java.util.Date of this ZIP entry. Supplied value is truncated to per-second precision (milliseconds zeroed-out). Note the setters for flags and timestamps are decoupled. Even if the timestamp is not-null, it will only be written out if the corresponding bit in the flags is also set.
| |
| setAccessTime | back to summary |
|---|---|
| public void setAccessTime(final ZipLong l) Sets the access time (seconds since epoch) of this ZIP entry using a ZipLong object Note: the setters for flags and timestamps are decoupled. Even if the timestamp is not-null, it will only be written out if the corresponding bit in the flags is also set.
| |
| setCreateFileTime | back to summary |
|---|---|
| public void setCreateFileTime(final FileTime time)
Sets the create time as a Note the setters for flags and timestamps are decoupled. Even if the timestamp is not-null, it will only be written out if the corresponding bit in the flags is also set. | |
| setCreateJavaTime | back to summary |
|---|---|
| public void setCreateJavaTime(final Date d) Sets the create time as a java.util.Date of this ZIP entry. Supplied value is truncated to per-second precision (milliseconds zeroed-out). Note the setters for flags and timestamps are decoupled. Even if the timestamp is not-null, it will only be written out if the corresponding bit in the flags is also set.
| |
| setCreateTime | back to summary |
|---|---|
| public void setCreateTime(final ZipLong l) Sets the create time (seconds since epoch) of this ZIP entry using a ZipLong object Note: the setters for flags and timestamps are decoupled. Even if the timestamp is not-null, it will only be written out if the corresponding bit in the flags is also set.
| |
| setFlags | back to summary |
|---|---|
| public void setFlags(final byte flags) Sets flags byte. The flags byte tells us which of the three datestamp fields are present in the data: bit0 - modify time bit1 - access time bit2 - create timeOnly first 3 bits of flags are used according to the latest version of the spec (December 2012).
| |
| setModifyFileTime | back to summary |
|---|---|
| public void setModifyFileTime(final FileTime time)
Sets the modify time as a Note the setters for flags and timestamps are decoupled. Even if the timestamp is not-null, it will only be written out if the corresponding bit in the flags is also set. | |
| setModifyJavaTime | back to summary |
|---|---|
| public void setModifyJavaTime(final Date d) Sets the modify time as a java.util.Date of this ZIP entry. Supplied value is truncated to per-second precision (milliseconds zeroed-out). Note the setters for flags and timestamps are decoupled. Even if the timestamp is not-null, it will only be written out if the corresponding bit in the flags is also set.
| |
| setModifyTime | back to summary |
|---|---|
| public void setModifyTime(final ZipLong l) Sets the modify time (seconds since epoch) of this ZIP entry using a ZipLong object. Note the setters for flags and timestamps are decoupled. Even if the timestamp is not-null, it will only be written out if the corresponding bit in the flags is also set.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns a String representation of this class useful for debugging purposes. | |
| unixTimeToFileTime | back to summary |
|---|---|
| private static FileTime unixTimeToFileTime(final ZipLong unixTime) | |
| unixTimeToZipLong | back to summary |
|---|---|
| private static ZipLong unixTimeToZipLong(final long unixTime) | |
| zipLongToDate | back to summary |
|---|---|
| private static Date zipLongToDate(final ZipLong unixTime) | |