Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Java
Posted by: Jordan Makris
Added: Mar 25, 2018 8:24 AM
Views: 9
Tags: no tags
Gets a single class node
  1. public static ClassNode getNode(final byte[] bytez) {
  2.         ClassReader cr = new ClassReader(bytez);
  3.         ClassNode cn = new ClassNode();
  4.         try {
  5.             cr.accept(cn, ClassReader.EXPAND_FRAMES);
  6.         } catch (Exception e) {
  7.             try {
  8.                 cr.accept(cn, ClassReader.SKIP_FRAMES);
  9.             } catch(Exception e2) {
  10.                 e2.printStackTrace(); //just skip it
  11.             }
  12.         }
  13.         cr = null;
  14.         return cn;
  15. }