< prev index next >

src/java.base/share/classes/java/util/zip/ZipFile.java

Print this page
rev 11478 : 8073497: Lazy conversion of ZipEntry time
Reviewed-by: TBD


 550     public Stream<? extends ZipEntry> stream() {
 551         return StreamSupport.stream(Spliterators.spliterator(
 552                 new ZipEntryIterator(), size(),
 553                 Spliterator.ORDERED | Spliterator.DISTINCT |
 554                         Spliterator.IMMUTABLE | Spliterator.NONNULL), false);
 555     }
 556 
 557     private ZipEntry getZipEntry(String name, long jzentry) {
 558         ZipEntry e = new ZipEntry();
 559         e.flag = getEntryFlag(jzentry);  // get the flag first
 560         if (name != null) {
 561             e.name = name;
 562         } else {
 563             byte[] bname = getEntryBytes(jzentry, JZENTRY_NAME);
 564             if (!zc.isUTF8() && (e.flag & EFS) != 0) {
 565                 e.name = zc.toStringUTF8(bname, bname.length);
 566             } else {
 567                 e.name = zc.toString(bname, bname.length);
 568             }
 569         }
 570         e.time = dosToJavaTime(getEntryTime(jzentry));
 571         e.crc = getEntryCrc(jzentry);
 572         e.size = getEntrySize(jzentry);
 573         e.csize = getEntryCSize(jzentry);
 574         e.method = getEntryMethod(jzentry);
 575         e.setExtra0(getEntryBytes(jzentry, JZENTRY_EXTRA), false);
 576         byte[] bcomm = getEntryBytes(jzentry, JZENTRY_COMMENT);
 577         if (bcomm == null) {
 578             e.comment = null;
 579         } else {
 580             if (!zc.isUTF8() && (e.flag & EFS) != 0) {
 581                 e.comment = zc.toStringUTF8(bcomm, bcomm.length);
 582             } else {
 583                 e.comment = zc.toString(bcomm, bcomm.length);
 584             }
 585         }
 586         return e;
 587     }
 588 
 589     private static native long getNextEntry(long jzfile, int i);
 590 




 550     public Stream<? extends ZipEntry> stream() {
 551         return StreamSupport.stream(Spliterators.spliterator(
 552                 new ZipEntryIterator(), size(),
 553                 Spliterator.ORDERED | Spliterator.DISTINCT |
 554                         Spliterator.IMMUTABLE | Spliterator.NONNULL), false);
 555     }
 556 
 557     private ZipEntry getZipEntry(String name, long jzentry) {
 558         ZipEntry e = new ZipEntry();
 559         e.flag = getEntryFlag(jzentry);  // get the flag first
 560         if (name != null) {
 561             e.name = name;
 562         } else {
 563             byte[] bname = getEntryBytes(jzentry, JZENTRY_NAME);
 564             if (!zc.isUTF8() && (e.flag & EFS) != 0) {
 565                 e.name = zc.toStringUTF8(bname, bname.length);
 566             } else {
 567                 e.name = zc.toString(bname, bname.length);
 568             }
 569         }
 570         e.time = getEntryTime(jzentry);
 571         e.crc = getEntryCrc(jzentry);
 572         e.size = getEntrySize(jzentry);
 573         e.csize = getEntryCSize(jzentry);
 574         e.method = getEntryMethod(jzentry);
 575         e.setExtra0(getEntryBytes(jzentry, JZENTRY_EXTRA), false);
 576         byte[] bcomm = getEntryBytes(jzentry, JZENTRY_COMMENT);
 577         if (bcomm == null) {
 578             e.comment = null;
 579         } else {
 580             if (!zc.isUTF8() && (e.flag & EFS) != 0) {
 581                 e.comment = zc.toStringUTF8(bcomm, bcomm.length);
 582             } else {
 583                 e.comment = zc.toString(bcomm, bcomm.length);
 584             }
 585         }
 586         return e;
 587     }
 588 
 589     private static native long getNextEntry(long jzfile, int i);
 590 


< prev index next >