Need help in generating an instruction list
maithily mundle <[email protected]>
| Newsgroups | gmane.comp.jakarta.bcel.devel |
|---|---|
| Message-ID | <[email protected]> |
Can someone tell me how to generate the code pasted below, I have to
generate a similar, but much more complex code...
try{
ClassParser parser = new ClassParser(filename);
JavaClass java_class = parser.parse();
Method[] methods = java_class.getMethods();
ConstantPool cp = java_class.getConstantPool();
Constant[] clist = cp.getConstantPool();
for(int k=0; k<clist.length; k++) {
if(clist[k] instanceof ConstantString) {
ConstantString cName =
(ConstantString)clist[k];
String cName1 = cName.getBytes(cp);
//System.out.println(cName1);
byte[] b = cName1.getBytes();
for (int i=0; i<b.length; i++)
b[i]^=2;
cName1 = new String(b);
//System.out.println(cName1);
//cName = cName1;
Constant cNew = new ConstantUtf8(cName1);
clist[k] = cNew;
}
}
}
catch(Exception e){
System.out.println(e);
}
Maithily Mundle,
CS Department,
OSU.