M
Morten Omholt Alver
Hi,
I'm using java.util.ZipOutputStream to write a zip file regularly, and
I'm trying to speed up the process by writing uncompressed entries to
the zip file (I don't really need compression). I've tried two ways of
achieving this.
First, calling out.setMethod(ZipOutputStream.STORED) before writing any
entries (out is the ZipOutputStrean instance). This should set
uncompressed mode according to the Javadoc. When I add this call, the
entries don't seem to be written to the zip file, and I get a
"java.util.zip.ZipException: ZIP file must have at least one entry" when
I call close() on the ZipOutputStream. Without calling setMethod(), the
zip file is written without error.
Second, calling entry.setMethod(ZipEntry.STORED) for each ZipEntry
before or after calling out.putNextEntry(entry). This gives the same result.
Is there something else I need to do when writing uncompressed zip
files, or is something broken here?
I'm running under Windows XP with Java SE 1.6.0_06.
I'm using java.util.ZipOutputStream to write a zip file regularly, and
I'm trying to speed up the process by writing uncompressed entries to
the zip file (I don't really need compression). I've tried two ways of
achieving this.
First, calling out.setMethod(ZipOutputStream.STORED) before writing any
entries (out is the ZipOutputStrean instance). This should set
uncompressed mode according to the Javadoc. When I add this call, the
entries don't seem to be written to the zip file, and I get a
"java.util.zip.ZipException: ZIP file must have at least one entry" when
I call close() on the ZipOutputStream. Without calling setMethod(), the
zip file is written without error.
Second, calling entry.setMethod(ZipEntry.STORED) for each ZipEntry
before or after calling out.putNextEntry(entry). This gives the same result.
Is there something else I need to do when writing uncompressed zip
files, or is something broken here?
I'm running under Windows XP with Java SE 1.6.0_06.