On 2018-07-04, Luís Filipe Nassif wrote:

> I am trying to create a zip file saving its entries accessTime and
> CreationTime, but when I open the zip file with 7zip, those dates are not
> shown,

...

> entry.setLastAccessTime(FileTime.fromMillis(System.currentTimeMillis()));

...

> Any idea why it does not work?

Commons Compress' ZipArchiveEntry inherits this method from ZipEntry. It
was added in Java8 and as Commons Compress currently targets Java7 we
haven't added any support for the new fields, yet.

Basically our code base doesn't know you have set the values at all.

The way you set the dates using Commons Compress' API is by creating a
X5455_ExtendedTimestamp extra field and attaching it to the
ZipArchiveEntry. If you want to be extra sure you create an additional
X000A_NTFS extra field. I'm not sure which of the two (maybe both?)
Java8 would use or which one 7z would consult (InfoZIP only uses the
ExtendedTimestamp IIRC).

Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

Reply via email to