Ejemplo n.º 1
0
 /**
  * Closes the current ZIP entry and positions the stream for writing the next entry. Checks that
  * the amount of data written matches the compressed size indicated by the ZipEntry.
  *
  * @throws ZipException if a ZIP file error has occurred
  * @throws IOException if an I/O exception has occurred
  */
 private void finishEntry() throws IOException {
   if (entry.getCompressedSize() != bytesWritten) {
     throw new ZipException(
         String.format(
             "Number of bytes written for the entry %s (%d) does not"
                 + " match the reported compressed size (%d).",
             entry.getName(), bytesWritten, entry.getCompressedSize()));
   }
   zipData.addEntry(entry);
   entry = null;
 }