如何使用com.strobel.decompiler.PlainTextOutput在控制台中打印

时间:2014-03-10 10:57:41

标签: java printing console decompiler

我在我的应用程序中使用Proycon库,PlainTextOutput是Proycon库中的一个类,

在谷歌搜索期间我找到了下面给出的代码块。这意味着什么,我可以使用这段代码打印到控制台吗?

com.strobel.decompiler.Decompiler.decompile(
         "D:\\BuildConfig.class",new com.strobel.decompiler.PlainTextOutput(new java.io.OutputStreamWriter(System.out)));

1 个答案:

答案 0 :(得分:1)

这似乎是对实施的疏忽;它并没有为你冲洗Writer。试试这个:

final PrintWriter writer = new PrintWriter(System.out);

try {
    com.strobel.decompiler.Decompiler.decompile(
        "D:\\BuildConfig.class",
        new com.strobel.decompiler.PlainTextOutput(writer)
    );
}
finally {
    writer.flush();
}

我会考虑为下一个Procyon版本修复它。

相关问题