示例#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);
 }
示例#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();
 }
 private String generateCRC() {
   Hashtable props = this.props;
   CRC32OutputStream crc = new CRC32OutputStream();
   PrintWriter pr = new PrintWriter(crc);
   Enumeration names = props.keys();
   while (names.hasMoreElements()) {
     String name = (String) names.nextElement();
     if (!name.equals("crc")) {
       pr.println((String) props.get(name));
     }
   }
   pr.flush();
   return "" + crc.getValue();
 }
示例#4
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);
 }