From: Robert Kochem on
Erik schrieb:

> Normally (in Winzip), uncompressed content immediately follows the
> filename, shows WinZIP. What are those 5 bytes for and how can I do
> things the WinZIP way ?

There are two ways for creating an uncompressed ZIP:

1. Mode: DEFLATER with compression = 0 (Deflater.NO_COMPRESSION)
2. Mode: STORED (required to compute manually the CRC and set size in the
ZipEntry:

byte[] data = // data to store
ZipEntry ze = new ZipEntry("entryname.txt");
ze.setMethod(ZipEntry.STORED);
ze.setCompressedSize(data.length);
ze.setSize(data.length);
CRC32 = new CRC32();
crc.update(data);
ze.setCrc(crc.getValue());
zipOutputStream.putNextEntry(ze);

Robert
From: Arne Vajhøj on
On 26-01-2010 05:04, Roedy Green wrote:
> On Mon, 25 Jan 2010 23:41:35 +0100, Erik<et57(a)hotmail.com> wrote,
> quoted or indirectly quoted someone who said :
>> file last modified on (0x00003c39 0x0000b52a): 2010-01-25
>
> One problem with ZIP format that bedevils me is that when you put a
> file into a zip, then restore it, the timestamp can be out by up to 2
> seconds! The restored file looks like a DIFFERENT version of the file.

The format only has 5 bits for seconds.

No surprise that it can be off.

> Further the timestamps are in local timezone rather than GMT, and the
> timezone is not recorded. Arrgh. I have been bugging the Winzip and
> the Truezip people to fix this.
>
> Vendors are reluctant, I think, primarily because an upward compatible
> solution would make files fatter. Archivers compete ferociously.

The ZIP format is a well-defined format (defined in APPNOTE).

Picking a new time format would make it not zip.

And would make it unreadable by all other zip tools out there.

Arne

From: Arne Vajhøj on
On 26-01-2010 04:56, Roedy Green wrote:
> ZIP format goes back to the DOS days. Originally file names were
> ASCII. I suspect there is some kludge in effect for filenames with a
> "weird" character like +, rather than simple UTF-8.
>
> The ZIP format is documented at PkZip.com. See
> http://mindprod.com/jgloss/zip.html

Then why don't you read it instead of speculating.

Unicode filename support was added in version
6.3.0.

It uses a flag and stores the filename as UTF-8.

Whether that is a kludge or not is rather subjective.

Arne
From: Mike Schilling on
Arne Vajh�j wrote:
> On 26-01-2010 04:56, Roedy Green wrote:
>> ZIP format goes back to the DOS days. Originally file names were
>> ASCII. I suspect there is some kludge in effect for filenames with
>> a
>> "weird" character like +, rather than simple UTF-8.
>>
>> The ZIP format is documented at PkZip.com. See
>> http://mindprod.com/jgloss/zip.html
>
> Then why don't you read it instead of speculating.
>
> Unicode filename support was added in version
> 6.3.0.
>
> It uses a flag and stores the filename as UTF-8.
>
> Whether that is a kludge or not is rather subjective.


I'm confused. How is "+" a weird character than can't be stored as
ASCII?


From: Roedy Green on
On Mon, 25 Jan 2010 23:41:35 +0100, Erik <et57(a)hotmail.com> wrote,
quoted or indirectly quoted someone who said :

>Some additional info from WinZIP about the Java-generated zip file:

I looked all over their site but could not find that info. Did you get
it in email?

--
Roedy Green Canadian Mind Products
http://mindprod.com
Computers are useless. They can only give you answers.
~ Pablo Picasso (born: 1881-10-25 died: 1973-04-08 at age: 91)