Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ASM Save ArrayList ClassNode as Zip File
#9
(01-21-2015, 12:31 AM)Swizzbeat Wrote:  Nice, mine differs slightly:

Code:
public static void dumpJar(List<ClassNode> classes, Manifest manifest, String absolutePath) {
   try (JarOutputStream jos = new JarOutputStream(new FileOutputStream(new File(absolutePath)), manifest)) {
       for (ClassNode cn : classes) {
           ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);

           jos.putNextEntry(new JarEntry(cn.name + ".class"));
           cn.accept(writer);
           jos.write(writer.toByteArray());
       }
   } catch (IOException e) {
       e.printStackTrace();
   }
}

Gotta have a manifest to make it runnable xD

Very true! Haha
Reply
 


Messages In This Thread
RE: ASM Save ArrayList ClassNode as Zip File - by Konloch - 01-21-2015, 01:24 AM

Forum Jump:


Users browsing this thread: 4 Guest(s)

About The Bytecode Club

We're a community forum focused on Reverse Engineering, we try to target Java/Android but we also include other langauges/platforms. We pride ourselves in supporting and free and open sourced applications.

Website