src/share/classes/java/util/zip/ZipOutputStream.java
Print this page
*** 159,168 ****
--- 159,200 ----
*/
public void setLevel(int level) {
def.setLevel(level);
}
+ public void writeNextEntry(ZipEntry e, byte[] b, int off, int len)
+ throws IOException
+ {
+ ensureOpen();
+ if (current != null) {
+ closeEntry(); // close previous entry
+ }
+ if (e.time == -1) {
+ e.setTime(System.currentTimeMillis());
+ }
+ if (e.method != DEFLATED) {
+ throw new ZipException("writeNextEntry: e.method must be DEFLATED");
+ }
+ if (e.size == -1 || e.csize == -1 || e.crc == -1) {
+ throw new ZipException("writeNextEntry: e.size/csize/crc is -1");
+ }
+ if (! names.add(e.name)) {
+ throw new ZipException("duplicate entry: " + e.name);
+ }
+ if (zc.isUTF8())
+ e.flag |= EFS;
+ current = new XEntry(e, written);
+ xentries.add(current);
+ writeLOC(current);
+ out.write(b, off, len);
+ written += len;
+ if ((e.flag & 8) != 0)
+ writeEXT(e);
+ crc.reset();
+ current = null;
+ }
+
/**
* Begins writing a new ZIP file entry and positions the stream to the
* start of the entry data. Closes the current entry if still active.
* The default compression method will be used if no compression method
* was specified for the entry, and the current time will be used if
*** 189,198 ****
--- 221,231 ----
// store size, compressed size, and crc-32 in data descriptor
// immediately following the compressed entry data
if (e.size == -1 || e.csize == -1 || e.crc == -1)
e.flag = 8;
+
break;
case STORED:
// compressed size, uncompressed size, and crc-32 must all be
// set for entries using STORED compression method
if (e.size == -1) {