public void testInflatingFilesRequiringZipRefill() throws IOException {
  int originalSize=1024 * 1024;
  byte[] readBuffer=new byte[8192];
  ZipFile zipFile=new ZipFile(createZipFile(1,originalSize));
  for (Enumeration<? extends ZipEntry> e=zipFile.entries(); e.hasMoreElements(); ) {
    ZipEntry zipEntry=e.nextElement();
    assertTrue("This test needs >64 KiB of compressed data to exercise Inflater",zipEntry.getCompressedSize() > (64 * 1024));
    InputStream is=zipFile.getInputStream(zipEntry);
    while (is.read(readBuffer,0,readBuffer.length) != -1) {
    }
    is.close();
  }
  zipFile.close();
}

public void testInflatingFilesRequiringZipRefill ( ) throws IOException { int originalSize = 1024 * 1024 ; byte [ ] readBuffer = new byte [ 8192 ] ; ZipFile zipFile = new ZipFile ( createZipFile ( 1 , originalSize ) ) ; for ( Enumeration < ? extends ZipEntry > e = zipFile . entries ( ) ; e . hasMoreElements ( ) ; ) { ZipEntry zipEntry = e . nextElement ( ) ; assertTrue ( "This test needs >64 KiB of compressed data to exercise Inflater" , zipEntry . getCompressedSize ( ) > ( 64 * 1024 ) ) ; InputStream is = zipFile . getInputStream ( zipEntry ) ; while ( is . read ( readBuffer , 0 , readBuffer . length ) != - 1 ) { } is . close ( ) ; } zipFile . close ( ) ; }
exercise inflater ' s ability to refill the zlib ' s input buffer . as of this writing , this buffer ' s max size is 64kib compressed bytes . we ' ll write a full megabyte of uncompressed data , which should be sufficient to exhaust the buffer . http : / / b / issue ? id = 2734751
