10-11-2014, 09:51 PM
Code:
public static void saveAsJar(ArrayList<ClassNode> nodeList, String fileName) {
try {
JarOutputStream out = new JarOutputStream(new FileOutputStream(fileName));
for (ClassNode cn : nodeList) {
ClassWriter cw = new ClassWriter(0);
cn.accept(cw);
out.putNextEntry(new ZipEntry(cn.name + ".class"));
out.write(cw.toByteArray());
out.closeEntry();
}
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}