Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

16
LINES

< > BotCompany Repo | #1033497 // bcelRoundtrip - .class to BCEL to .class

JavaX fragment (include) [tags: use-pretranspiled]

Uses 1311K of libraries. Click here for Pure Java version (4545L/25K).

!include once #1019934 // BCEL

import org.apache.bcel.classfile.Attribute;
import org.apache.bcel.classfile.SourceFile;
import org.apache.bcel.generic.*;

static void bcelRoundtrip(InputStream classFile, S fileName, IVF1<ClassGen> modifier default null, OutputStream newClassFile) ctex {
  JavaClass c = new ClassParser(classFile, fileName).parse();

  ClassGen g = new ClassGen(c);
  
  modifier?.get(g);
  
  c = g.getJavaClass();
  c.dump(newClassFile);
}

Author comment

Began life as a copy of #1004069

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, ekrmjmnbrukm, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033497
Snippet name: bcelRoundtrip - .class to BCEL to .class
Eternal ID of this version: #1033497/6
Text MD5: 1757a8fba3fdd9eba62abbe93fa25b8e
Transpilation MD5: 510f7f2edc49a6695360d824860e9fe5
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-10-29 07:12:30
Source code size: 474 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 158 / 222
Version history: 5 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1033511 - bcelSave - BCEL to .class