+package org.ibex.core;
+import org.ibex.classgen.*;
+import java.io.*;
+import java.util.*;
+import java.util.zip.*;
+
+public class OptimizeCore {
+ public static void main(String[] s) throws Exception {
+ File outf = new File(s[0] + "-");
+ File inf = new File(s[0]);
+ ZipOutputStream out = new ZipOutputStream(new FileOutputStream(outf));
+ ZipInputStream zis = new ZipInputStream(new FileInputStream(inf));
+ for(;;) {
+ ZipEntry ze = zis.getNextEntry();
+ if (ze==null) break;
+ out.putNextEntry(ze);
+ String name = ze.getName();
+ if (!name.endsWith(".class")) {
+ byte b[] = new byte[1024];
+ for(;;) {
+ int numread = zis.read(b, 0, b.length);
+ if (numread==-1) break;
+ out.write(b, 0, numread);
+ }
+ continue;
+ }
+ System.out.println("updating " + name.substring(0, name.length()-6).replace('$','.').replace('/','.'));
+ ClassFile cf = new ClassFile(new DataInputStream(zis));
+ cf.dump(out);
+ }
+ out.close();
+ outf.renameTo(inf);
+ }
+}