[Kaffe] Help!, ZipEntry confusion.

Alex Nicolaou anicolao at mud.cgl.uwaterloo.ca
Sun Feb 14 19:44:26 PST 1999


Moses DeJong wrote:

> I am currently working on some of the java.util.zip classes but I am
> hopelessly stuck. I can not figure out how one is supposed to use the
> ZipOutputStream and ZipEntry objects to write out uncompressed
> (STORED) data streams. Writing of compressed (DEFLATED) streams works
> as expected, but there seems to be a catch-22 in the API for uncompressed
> streams. I have included a small example that shows the problem below.
> The real issue here is that the ZipOutputStream requires that both the
> crc and size values of a ZipEntry are set before and output stream is
> written. This is not possible because you would not know how much data
> was going to be written before you started writing it. 

In the stored case the size of the data is the file size, and you have
to make two passes over the file, one using CRC32 to compute the CRC and
one to write the file to the output stream.

alex


More information about the kaffe mailing list