src/java.base/share/classes/java/util/zip/Inflater.java
changeset 48330 e8230b52a8f4
parent 48294 2608240fc957
child 48337 0ee20aad71c4
equal deleted inserted replaced
48329:984c4b99afc9 48330:e8230b52a8f4
    22  * or visit www.oracle.com if you need additional information or have any
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    23  * questions.
    24  */
    24  */
    25 
    25 
    26 package java.util.zip;
    26 package java.util.zip;
    27 
       
    28 import java.util.function.LongConsumer;
       
    29 import java.util.function.LongSupplier;
       
    30 
    27 
    31 /**
    28 /**
    32  * This class provides support for general purpose decompression using the
    29  * This class provides support for general purpose decompression using the
    33  * popular ZLIB compression library. The ZLIB compression library was
    30  * popular ZLIB compression library. The ZLIB compression library was
    34  * initially developed as part of the PNG graphics standard and is not
    31  * initially developed as part of the PNG graphics standard and is not
   116      * library in order to support certain optimizations.
   113      * library in order to support certain optimizations.
   117      *
   114      *
   118      * @param nowrap if true then support GZIP compatible compression
   115      * @param nowrap if true then support GZIP compatible compression
   119      */
   116      */
   120     public Inflater(boolean nowrap) {
   117     public Inflater(boolean nowrap) {
   121         this.zsRef = ZStreamRef.get(this,
   118         this.zsRef = ZStreamRef.get(this, () -> init(nowrap), Inflater::end);
   122                 // Desugared for startup purposes.
       
   123                 new LongSupplier() {
       
   124                     @Override
       
   125                     public long getAsLong() {
       
   126                         return init(nowrap);
       
   127                     }
       
   128                 },
       
   129                 new LongConsumer() {
       
   130                     @Override
       
   131                     public void accept(long value) {
       
   132                         end();
       
   133                     }
       
   134                 });
       
   135     }
   119     }
   136 
   120 
   137     /**
   121     /**
   138      * Creates a new decompressor.
   122      * Creates a new decompressor.
   139      */
   123      */