Ejemplo n.º 1
0
 /**
  * Writes the local file header for the ZIP entry and positions the stream to the start of the
  * entry data.
  *
  * @param e the ZIP entry for which to write the local file header
  * @throws ZipException if a ZIP file error has occurred
  * @throws IOException if an I/O exception has occurred
  */
 private void startEntry(ZipFileEntry e) throws IOException {
   if (e.getTime() == -1) {
     throw new IllegalArgumentException("Zip entry last modified time must be set");
   }
   if (e.getCrc() == -1) {
     throw new IllegalArgumentException("Zip entry CRC-32 must be set");
   }
   if (e.getSize() == -1) {
     throw new IllegalArgumentException("Zip entry uncompressed size must be set");
   }
   if (e.getCompressedSize() == -1) {
     throw new IllegalArgumentException("Zip entry compressed size must be set");
   }
   bytesWritten = 0;
   entry = e;
   entry.setFlag(Flag.DATA_DESCRIPTOR, false);
   entry.setLocalHeaderOffset(stream.getCount());
   stream.write(LocalFileHeader.create(entry, zipData, allowZip64));
 }