当前位置: 首页>>代码示例>>Java>>正文


Java类org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler代码示例

以下是Javaorg.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler的代码示例。类ConsoleDecompiler属于org.jetbrains.java.decompiler.main.decompiler包,如果您正苦于以下问题:Java ConsoleDecompiler类的具体用法?Java ConsoleDecompiler怎么用?Java ConsoleDecompiler使用的例子?那么恭喜您, 这里整理的类代码示例例程将为您提供帮助。

本文一共展示了ConsoleDecompiler的6个开源代码实例,这些例子默认根据受欢迎程度排序。您可以为喜欢的代码打CALL点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setUp

import org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler; //导入依赖的package包/类
public void setUp(final Map<String, Object> options) throws IOException {
  testDataDir = new File("testData");
  if (!isTestDataDir(testDataDir)) testDataDir = new File("community/plugins/java-decompiler/engine/testData");
  if (!isTestDataDir(testDataDir)) testDataDir = new File("plugins/java-decompiler/engine/testData");
  if (!isTestDataDir(testDataDir)) testDataDir = new File("../community/plugins/java-decompiler/engine/testData");
  if (!isTestDataDir(testDataDir)) testDataDir = new File("../plugins/java-decompiler/engine/testData");
  assertTrue("current dir: " + new File("").getAbsolutePath(), isTestDataDir(testDataDir));
  testDataDir = testDataDir.getAbsoluteFile();

  //noinspection SSBasedInspection
  tempDir = File.createTempFile("decompiler_test_", "_dir");
  assertTrue(tempDir.delete());

  targetDir = new File(tempDir, "decompiled");
  assertTrue(targetDir.mkdirs());
  decompiler = new ConsoleDecompiler(this.targetDir, new HashMap<String, Object>() {{
    put(IFernflowerPreferences.LOG_LEVEL, "warn");
    put(IFernflowerPreferences.DECOMPILE_GENERIC_SIGNATURES, "1");
    put(IFernflowerPreferences.REMOVE_SYNTHETIC, "1");
    put(IFernflowerPreferences.REMOVE_BRIDGE, "1");
    put(IFernflowerPreferences.LITERALS_AS_IS, "1");
    put(IFernflowerPreferences.UNIT_TEST_MODE, "1");
    putAll(options);
  }});
}
 
开发者ID:jskierbi,项目:intellij-ce-playground,完整代码来源:DecompilerTestFixture.java


示例2: decompileToZip

import org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler; //导入依赖的package包/类
@Override
public void decompileToZip(String zipName) {
    try {
        Path outputDir = Files.createTempDirectory("fernflower_output");
        Path tempJar = Files.createTempFile("fernflower_input", ".jar");
        File output = new File(zipName);
        JarUtils.saveAsJar(BytecodeViewer.getLoadedBytes(), tempJar.toAbsolutePath().toString());
        ConsoleDecompiler decompiler = new ConsoleDecompiler(outputDir.toFile(), main(generateMainMethod()));
        decompiler.addSpace(tempJar.toFile(), true);
        decompiler.decompileContext();
        Files.move(outputDir.toFile().listFiles()[0].toPath(), output.toPath());
        Files.delete(tempJar);
        FileUtils.deleteDirectory(outputDir.toFile());
    } catch (Exception e) {
        handleException(e);
    }
}
 
开发者ID:Konloch,项目:bytecode-viewer,完整代码来源:FernFlowerDecompiler.java


示例3: testDirectory

import org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler; //导入依赖的package包/类
@Test
public void testDirectory() {
  File classes = new File(fixture.getTempDir(), "classes");
  unpack(new File(fixture.getTestDataDir(), "bulk.jar"), classes);

  ConsoleDecompiler decompiler = fixture.getDecompiler();
  decompiler.addSpace(classes, true);
  decompiler.decompileContext();

  assertFilesEqual(new File(fixture.getTestDataDir(), "bulk"), fixture.getTargetDir());
}
 
开发者ID:jskierbi,项目:intellij-ce-playground,完整代码来源:BulkDecompilationTest.java


示例4: testJar

import org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler; //导入依赖的package包/类
@Test
public void testJar() {
  ConsoleDecompiler decompiler = fixture.getDecompiler();
  decompiler.addSpace(new File(fixture.getTestDataDir(), "bulk.jar"), true);
  decompiler.decompileContext();

  File unpacked = new File(fixture.getTempDir(), "unpacked");
  unpack(new File(fixture.getTargetDir(), "bulk.jar"), unpacked);

  assertFilesEqual(new File(fixture.getTestDataDir(), "bulk"), unpacked);
}
 
开发者ID:jskierbi,项目:intellij-ce-playground,完整代码来源:BulkDecompilationTest.java


示例5: decompileWithFernFlower

import org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler; //导入依赖的package包/类
private void decompileWithFernFlower(final File jarInputFile, final File javaOutputDir){

        ThreadGroup group = new ThreadGroup("Jar 2 Java Group");
        Thread javaExtractionThread = new Thread(group, new Runnable() {
            @Override
            public void run() {
                boolean javaError = false;
                try {

                    final Map<String, Object> mapOptions = new HashMap<>();
                    PrintStreamLogger logger = new PrintStreamLogger(printStream);
                    ConsoleDecompiler decompiler = new ConsoleDecompiler(javaOutputDir, mapOptions, logger);
                    decompiler.addSpace(jarInputFile, true);
                    decompiler.decompileContext();

                    File decompiledJarFile = new File(javaOutputDir + "/" + packageName +".jar");

                    if(decompiledJarFile.exists()) {
                        ZipUtils.unzip(decompiledJarFile, javaOutputDir, printStream);
                        decompiledJarFile.delete();
                    } else {
                        javaError = true;
                    }

                } catch (Exception | StackOverflowError e) {
                    Ln.e(e);
                    javaError = true;
                }
                startXMLExtractor(!javaError);
            }
        }, "Jar to Java Thread", processService.STACK_SIZE);

        javaExtractionThread.setPriority(Thread.MAX_PRIORITY);
        javaExtractionThread.setUncaughtExceptionHandler(exceptionHandler);
        javaExtractionThread.start();

    }
 
开发者ID:niranjan94,项目:show-java,完整代码来源:JavaExtractor.java


示例6: getDecompiler

import org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler; //导入依赖的package包/类
public ConsoleDecompiler getDecompiler() {
  return decompiler;
}
 
开发者ID:jskierbi,项目:intellij-ce-playground,完整代码来源:DecompilerTestFixture.java



注:本文示例均筛选自Github平台上各路大神开发的开源项目,代码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。