commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: [compress] not able to set extra field ExtendedTimestamp using commons.compress.archivers.zip
Date Sun, 03 Nov 2013 10:03:16 GMT
On 2013-11-02, yogeshrai wrote:

> M trying to use extra field support in apache.commons.compress.archivers
> version 1.5.Some how its not getting set since m not able to view it in hex
> editor and even after extracting using default ubuntu archive manager,last
> modified time is still set as server current timestamp ,even if i hv passed
> old date for testing.Kindly suggest.

I've just re-read the code of X5455_ExtendedTimestamp and its API is a
bit inconvenient for people creating the extra data.  It is really more
geared towards reading the extra fields.

In order to add a timestamp you not only set the corresponding
Time-fields, you must also set a flag indicating the time is actualy
present.  In your case you are missing

                     xf.setFlags(1);

2 for access time and 4 for create time added together - see javadocs
of the setFlags method.  This is a bit inconvenient and I'll simplify
the API in trunk soonish.

BTW you could use setModifyJavaTime rather than setModifyTime to
simplify your code a little.

Stefan

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


Mime
View raw message