allow writing to zip files

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@331 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent f9a7c0e3e2
commit 301160b29b
  1. 27
      jode/jode/obfuscator/ClassBundle.java

@ -21,6 +21,7 @@ import jode.Obfuscator;
import jode.bytecode.ClassInfo;
import java.io.*;
import java.util.*;
import java.util.zip.ZipOutputStream;
public class ClassBundle {
@ -99,13 +100,27 @@ public class ClassBundle {
}
public void storeClasses(String destination) {
File directory = new File(destination);
if (!directory.exists()) {
Obfuscator.err.println("Destination directory "
+directory.getPath()+" doesn't exists.");
return;
if (destination.endsWith(".jar") ||
destination.endsWith(".zip")) {
try {
ZipOutputStream zip = new ZipOutputStream
(new FileOutputStream(destination));
basePackage.storeClasses(zip);
zip.close();
} catch (IOException ex) {
System.err.println("Can't write zip file: "+destination);
ex.printStackTrace();
}
} else {
File directory = new File(destination);
if (!directory.exists()) {
Obfuscator.err.println("Destination directory "
+directory.getPath()
+" doesn't exists.");
return;
}
basePackage.storeClasses(new File(destination));
}
basePackage.storeClasses(new File(destination));
}
}

Loading…
Cancel
Save