Example #1
0
 /** Computes the crc32 of a File. This is necessary when the ZipOutputStream is in STORED mode. */
 private void crc32File(ZipEntry e, File f) throws IOException {
   CRC32OutputStream os = new CRC32OutputStream();
   copy(f, os);
   if (os.n != f.length()) {
     throw new JarException(formatMsg("error.incorrect.length", f.getPath()));
   }
   os.updateEntry(e);
 }
Example #2
0
 private void addIndex(JarIndex index, ZipOutputStream zos) throws IOException {
   ZipEntry e = new ZipEntry(INDEX_NAME);
   e.setTime(System.currentTimeMillis());
   if (flag0) {
     CRC32OutputStream os = new CRC32OutputStream();
     index.write(os);
     os.updateEntry(e);
   }
   zos.putNextEntry(e);
   index.write(zos);
   zos.closeEntry();
 }
Example #3
0
 /**
  * Computes the crc32 of a Manifest. This is necessary when the ZipOutputStream is in STORED mode.
  */
 private void crc32Manifest(ZipEntry e, Manifest m) throws IOException {
   CRC32OutputStream os = new CRC32OutputStream();
   m.write(os);
   os.updateEntry(e);
 }