Search Java Code Snippets


  Help us in improving the repository. Add new snippets through 'Submit Code Snippet ' link.





Java - Code Samples

 Sample 1. Code Sample / Example / Snippet of org.apache.bcel.classfile.Code

    private void compare(final String name, final Method m) {

final Code c = m.getCode();

if (c == null) {

return; // e.g. abstract method

}

final byte[] src = c.getCode();

final InstructionList il = new InstructionList(src);

final byte[] out = il.getByteCode();

if (src.length == out.length) {

assertArrayEquals(name + ": " + m.toString(), src, out);

} else {

System.out.println(name + ": " + m.toString() + " " + src.length + " " + out.length);

System.out.println(bytesToHex(src));

System.out.println(bytesToHex(out));

for (final InstructionHandle ih : il) {

System.out.println(ih.toString(false));

}

fail("Array comparison failure");

}

}


   Like      Feedback      org.apache.bcel.classfile.Code



Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner