Package jadx.core.codegen

Examples of jadx.core.codegen.CodeWriter


    save(dir, args, cls);
    return false;
  }

  public static void save(File dir, IJadxArgs args, ClassNode cls) {
    CodeWriter clsCode = cls.getCode();
    String fileName = cls.getClassInfo().getFullPath() + ".java";
    if (args.isFallbackMode()) {
      fileName += ".jadx";
    }
    clsCode.save(dir, fileName);
  }
View Full Code Here


          str.append(escape(insn + " " + insn.getAttributesString()));
          str.append(NL);
        }
        return str.toString();
      } else {
        CodeWriter code = new CodeWriter();
        List<InsnNode> instructions = block.getInstructions();
        MethodGen.addFallbackInsns(code, mth,
            instructions.toArray(new InsnNode[instructions.size()]), false);
        String str = escape(code.newLine().toString());
        if (str.startsWith(NL)) {
          str = str.substring(NL.length());
        }
        return str;
      }
View Full Code Here

  }

  @Test
  public void test() {
    ClassNode cls = getClassNode(TestCls.class);
    CodeWriter codeWriter = cls.getCode();
    String code = codeWriter.toString();

    Map<Integer, Integer> lineMapping = codeWriter.getLineMapping();
    assertEquals("{8=18, 11=22, 12=23, 13=24, 14=28, 16=25, 17=26, 18=28, 21=31, 22=32}",
        lineMapping.toString());
  }
View Full Code Here

    this.cls = classNode;
    this.parent = parent;
  }

  public String getCode() {
    CodeWriter code = cls.getCode();
    if (code == null) {
      decompile();
      code = cls.getCode();
    }
    if (code == null) {
      return "";
    }
    return code.toString();
  }
View Full Code Here

TOP

Related Classes of jadx.core.codegen.CodeWriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.