public JarModifier(File jarFile) throws JarException, IOException {
  this.jarFile=jarFile;
  JarFile jar=new JarFile(jarFile);
  Enumeration<? extends JarEntry> enumerator=jar.entries();
  while (enumerator.hasMoreElements()) {
    JarEntry currentEntry=(JarEntry)enumerator.nextElement();
    JarEntry resetEntry=new JarEntry(currentEntry.getName());
    jarEntries.put(currentEntry.getName(),resetEntry);
  }
  String manifestPath=META_INF + SEPERATOR + "MANIFEST.MF";
  JarEntry jarEntry=jar.getJarEntry(manifestPath);
  if (jarEntry != null) {
    Enumeration<JarEntry> entries=jar.entries();
    while (entries.hasMoreElements()) {
      jarEntry=(JarEntry)entries.nextElement();
      if (manifestPath.equalsIgnoreCase(jarEntry.getName())) {
        break;
      }
 else {
        jarEntry=null;
      }
    }
  }
  Manifest manifest=new Manifest();
  if (jarEntry != null) {
    manifest.read(jar.getInputStream(jarEntry));
  }
  this.manifest=manifest;
  jar.close();
}

public JarModifier ( File jarFile ) throws JarException , IOException { this . jarFile = jarFile ; JarFile jar = new JarFile ( jarFile ) ; Enumeration < ? extends JarEntry > enumerator = jar . entries ( ) ; while ( enumerator . hasMoreElements ( ) ) { JarEntry currentEntry = ( JarEntry ) enumerator . nextElement ( ) ; JarEntry resetEntry = new JarEntry ( currentEntry . getName ( ) ) ; jarEntries . put ( currentEntry . getName ( ) , resetEntry ) ; } String manifestPath = META_INF + SEPERATOR + "MANIFEST.MF" ; JarEntry jarEntry = jar . getJarEntry ( manifestPath ) ; if ( jarEntry != null ) { Enumeration < JarEntry > entries = jar . entries ( ) ; while ( entries . hasMoreElements ( ) ) { jarEntry = ( JarEntry ) entries . nextElement ( ) ; if ( manifestPath . equalsIgnoreCase ( jarEntry . getName ( ) ) ) { break ; } else { jarEntry = null ; } } } Manifest manifest = new Manifest ( ) ; if ( jarEntry != null ) { manifest . read ( jar . getInputStream ( jarEntry ) ) ; } this . manifest = manifest ; jar . close ( ) ; }
creates a new jarmodifier with the given archive to be modified
