On Nov 22, 2007, at 9:48 PM, Patrick Lacour wrote:
Or use this legacy "DOS date" ? I would search in zip specs...
Date of ZIP building will be better than compilation date,
since it would reflect not only bytecode modification,
but also resources modifs.
This isn't originally mine but I've been using it for some time...
/**
* Converts the <tt>.zip</tt> time and date into a Date object.
* @param time the <tt>.zip</tt> time.
* @param date the <tt>.zip</tt> date.
* @return a Date object with the <tt>.zip</tt> time and date.
**/
static Date timeAndDate(int time, int date) {
time = shuffleShort(time);
date = shuffleShort(date);
int seconds = (time & 0x001F) << 1;
int minutes = (time & 0x07E0) >> 5;
int hours = (time & 0xF800) >> 11;
int day = date & 0x001F;
int month = (date & 0x01E0) >> 5;
int year = (date & 0xFE00) >> 9;
/**
* Converts the time in a Date object to a <tt>.zip</tt> time.
* @param date the Date object.
* @return the <tt>.zip</tt> time.
**/
static int zipTime(Date date) {
int seconds = date.getSeconds();
int minutes = date.getMinutes();
int hours = date.getHours();
/**
* Shuffles a short from <tt>.zip</tt> byte order to <tt>.java</tt>
byte order
* or vice versa.
* @param val the short to shuffle.
**/
static int shuffleShort(int val) {
return ((val & 0x00FF) << 8) + ((val >> 8) & 0x00FF);
}
JHLZip I think was what the original code was called, I lost track of
where it might currently be available.
TRZ or Transparent Random Zip is what my modified version was called.
This particular code though I think saw no modifications.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden