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

Print this page
rev 3186 : 6880112: Project Coin: Port JDK core library code to use diamond operator


 526      */
 527     public int size() {
 528         ensureOpen();
 529         return total;
 530     }
 531 
 532     /**
 533      * Closes the ZIP file.
 534      * <p> Closing this ZIP file will close all of the input streams
 535      * previously returned by invocations of the {@link #getInputStream
 536      * getInputStream} method.
 537      *
 538      * @throws IOException if an I/O error has occurred
 539      */
 540     public void close() throws IOException {
 541         synchronized (this) {
 542             closeRequested = true;
 543 
 544             if (streams.size() !=0) {
 545                 Set<InputStream> copy = streams;
 546                 streams = new HashSet<InputStream>();
 547                 for (InputStream is: copy)
 548                     is.close();
 549             }
 550 
 551             if (jzfile != 0) {
 552                 // Close the zip file
 553                 long zf = this.jzfile;
 554                 jzfile = 0;
 555 
 556                 close(zf);
 557 
 558                 // Release inflaters
 559                 synchronized (inflaters) {
 560                     int size = inflaters.size();
 561                     for (int i = 0; i < size; i++) {
 562                         Inflater inf = (Inflater)inflaters.get(i);
 563                         inf.end();
 564                     }
 565                 }
 566             }




 526      */
 527     public int size() {
 528         ensureOpen();
 529         return total;
 530     }
 531 
 532     /**
 533      * Closes the ZIP file.
 534      * <p> Closing this ZIP file will close all of the input streams
 535      * previously returned by invocations of the {@link #getInputStream
 536      * getInputStream} method.
 537      *
 538      * @throws IOException if an I/O error has occurred
 539      */
 540     public void close() throws IOException {
 541         synchronized (this) {
 542             closeRequested = true;
 543 
 544             if (streams.size() !=0) {
 545                 Set<InputStream> copy = streams;
 546                 streams = new HashSet<>();
 547                 for (InputStream is: copy)
 548                     is.close();
 549             }
 550 
 551             if (jzfile != 0) {
 552                 // Close the zip file
 553                 long zf = this.jzfile;
 554                 jzfile = 0;
 555 
 556                 close(zf);
 557 
 558                 // Release inflaters
 559                 synchronized (inflaters) {
 560                     int size = inflaters.size();
 561                     for (int i = 0; i < size; i++) {
 562                         Inflater inf = (Inflater)inflaters.get(i);
 563                         inf.end();
 564                     }
 565                 }
 566             }