Search in sources :

Example 1 with BaksmaliDumpOut

use of com.googlecode.d2j.smali.BaksmaliDumpOut in project dex2jar by pxb1988.

the class DexWaveTest method toStd.

public static String toStd(DexClassNode expected) throws IOException {
    StringWriter stringWriter = new StringWriter();
    BufferedWriter bufferedWriter = new BufferedWriter(stringWriter);
    BaksmaliDumpOut out = new BaksmaliDumpOut(bufferedWriter);
    final BaksmaliDumper bs = new BaksmaliDumper(true, false);
    bs.baksmaliClass(expected, out);
    bufferedWriter.close();
    return stringWriter.toString();
}
Also used : StringWriter(java.io.StringWriter) BaksmaliDumper(com.googlecode.d2j.smali.BaksmaliDumper) BaksmaliDumpOut(com.googlecode.d2j.smali.BaksmaliDumpOut) BufferedWriter(java.io.BufferedWriter)

Example 2 with BaksmaliDumpOut

use of com.googlecode.d2j.smali.BaksmaliDumpOut in project dex2jar by pxb1988.

the class SmaliTest method test.

@Test
public void test() throws IOException {
    DexFileNode dfn = new DexFileNode();
    Smali.smaliFile(new File("src/test/resources/a.smali").toPath(), dfn);
    for (DexClassNode dcn : dfn.clzs) {
        BufferedWriter w = new BufferedWriter(new OutputStreamWriter(System.out));
        new BaksmaliDumper(true, true).baksmaliClass(dcn, new BaksmaliDumpOut(w));
        w.flush();
    }
}
Also used : DexClassNode(com.googlecode.d2j.node.DexClassNode) BaksmaliDumper(com.googlecode.d2j.smali.BaksmaliDumper) DexFileNode(com.googlecode.d2j.node.DexFileNode) DexBackedDexFile(org.jf.dexlib2.dexbacked.DexBackedDexFile) BaksmaliDumpOut(com.googlecode.d2j.smali.BaksmaliDumpOut) Test(org.junit.Test)

Example 3 with BaksmaliDumpOut

use of com.googlecode.d2j.smali.BaksmaliDumpOut in project dex2jar by pxb1988.

the class SmaliTest method pbaksmali.

private static String pbaksmali(DexClassNode dcn) throws IOException {
    StringWriter bufWriter = new StringWriter();
    BufferedWriter w = new BufferedWriter(bufWriter);
    new BaksmaliDumper(true, true).baksmaliClass(dcn, new BaksmaliDumpOut(w));
    w.flush();
    bufWriter.flush();
    return bufWriter.toString();
}
Also used : BaksmaliDumper(com.googlecode.d2j.smali.BaksmaliDumper) BaksmaliDumpOut(com.googlecode.d2j.smali.BaksmaliDumpOut)

Aggregations

BaksmaliDumpOut (com.googlecode.d2j.smali.BaksmaliDumpOut)3 BaksmaliDumper (com.googlecode.d2j.smali.BaksmaliDumper)3 DexClassNode (com.googlecode.d2j.node.DexClassNode)1 DexFileNode (com.googlecode.d2j.node.DexFileNode)1 BufferedWriter (java.io.BufferedWriter)1 StringWriter (java.io.StringWriter)1 DexBackedDexFile (org.jf.dexlib2.dexbacked.DexBackedDexFile)1 Test (org.junit.Test)1