src/share/classes/java/util/zip/ZipInputStream.java

Print this page




 302         if ((flag & 1) == 1) {
 303             throw new ZipException("encrypted ZIP entry not supported");
 304         }
 305         e.method = get16(tmpbuf, LOCHOW);
 306         e.time = dosToJavaTime(get32(tmpbuf, LOCTIM));
 307         if ((flag & 8) == 8) {
 308             /* "Data Descriptor" present */
 309             if (e.method != DEFLATED) {
 310                 throw new ZipException(
 311                         "only DEFLATED entries can have EXT descriptor");
 312             }
 313         } else {
 314             e.crc = get32(tmpbuf, LOCCRC);
 315             e.csize = get32(tmpbuf, LOCSIZ);
 316             e.size = get32(tmpbuf, LOCLEN);
 317         }
 318         len = get16(tmpbuf, LOCEXT);
 319         if (len > 0) {
 320             byte[] extra = new byte[len];
 321             readFully(extra, 0, len);
 322             e.setExtra0(extra, true);

 323         }
 324         return e;
 325     }
 326 
 327     /**
 328      * Creates a new <code>ZipEntry</code> object for the specified
 329      * entry name.
 330      *
 331      * @param name the ZIP file entry name
 332      * @return the ZipEntry just created
 333      */
 334     protected ZipEntry createZipEntry(String name) {
 335         return new ZipEntry(name);
 336     }
 337 
 338     /*
 339      * Reads end of deflated entry as well as EXT descriptor if present.
 340      */
 341     private void readEnd(ZipEntry e) throws IOException {
 342         int n = inf.getRemaining();




 302         if ((flag & 1) == 1) {
 303             throw new ZipException("encrypted ZIP entry not supported");
 304         }
 305         e.method = get16(tmpbuf, LOCHOW);
 306         e.time = dosToJavaTime(get32(tmpbuf, LOCTIM));
 307         if ((flag & 8) == 8) {
 308             /* "Data Descriptor" present */
 309             if (e.method != DEFLATED) {
 310                 throw new ZipException(
 311                         "only DEFLATED entries can have EXT descriptor");
 312             }
 313         } else {
 314             e.crc = get32(tmpbuf, LOCCRC);
 315             e.csize = get32(tmpbuf, LOCSIZ);
 316             e.size = get32(tmpbuf, LOCLEN);
 317         }
 318         len = get16(tmpbuf, LOCEXT);
 319         if (len > 0) {
 320             byte[] extra = new byte[len];
 321             readFully(extra, 0, len);
 322             e.setExtra0(extra,
 323                         e.csize == ZIP64_MAGICVAL || e.size == ZIP64_MAGICVAL);
 324         }
 325         return e;
 326     }
 327 
 328     /**
 329      * Creates a new <code>ZipEntry</code> object for the specified
 330      * entry name.
 331      *
 332      * @param name the ZIP file entry name
 333      * @return the ZipEntry just created
 334      */
 335     protected ZipEntry createZipEntry(String name) {
 336         return new ZipEntry(name);
 337     }
 338 
 339     /*
 340      * Reads end of deflated entry as well as EXT descriptor if present.
 341      */
 342     private void readEnd(ZipEntry e) throws IOException {
 343         int n = inf.getRemaining();