Class DexDecompilerExporter
java.lang.Object
com.pnfsoftware.jeb.core.units.code.DecompilerExporter
com.pnfsoftware.jeb.core.units.code.android.DexDecompilerExporter
Helper class used to decompile and export to
*.java files all or a subset of classes or
methods of a Dex unit.
Example: export all top-level classes to an output folder:
IDexDecompilerUnit dexdec = ...; // retrieve from the current IRuntimeProject
File outdir = ...;
DexDecompilerExporter exp = dexdec.getExporter();
exp.setOutputFolder(outdir, false);
exp.setMethodTimeout(60_000L); // safety
exp.setTotalTimeout(15 * 60_000L); // safety
exp.setCallback(new ProgressCallbackAdapter() {
@Override
public void message(String msg) {
System.out.println(msg);
}
});
boolean success = exp.processTopLevelClasses();
System.out.println("Errors: " + exp.getErrors());
-
Field Summary
Fields inherited from class com.pnfsoftware.jeb.core.units.code.DecompilerExporter
callback, decomp, discardDecompiledItemsAfterProcessing, errormap, headerString, methodTimeoutMs, outputFolder, pattern, totalTimeoutMs, usesCustomDecompWriter, writeCount, writeErrorCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcustomizeOptions(boolean decompilingClasses, DecompilationOptions.Builder optbld) Optional method used to customize the options of the decompilation context.protected StringgenerateClassFileName(String csig) protected StringgenerateMethodFileName(String msig) booleanprocess()Decompile and export all meaningful elements.voidsetSignaturePattern(Pattern pattern) The strings that will be provided to the matcher are jvm (canonical) class or method signatures, e.g.Methods inherited from class com.pnfsoftware.jeb.core.units.code.DecompilerExporter
export, getCallback, getDecompiler, getErrors, getGeneratedFileCount, getHeaderString, getMethodTimeout, getOutputFolder, getSignaturePattern, getTotalTimeout, isKeepDecompiledItemsAfterProcessing, processMethods, processTopLevelClasses, reset, setCallback, setDiscardDecompiledItemsAfterProcessing, setHeaderString, setMethodTimeout, setOutputFolder, setOutputFolder, setTotalTimeout, writeClassDecompilation, writeMethodDecompilation
-
Constructor Details
-
DexDecompilerExporter
-
-
Method Details
-
process
public boolean process()Description copied from class:DecompilerExporterDecompile and export all meaningful elements. This is the recommended method to call. Top-level classes and their constituents will be exported; orphaned methods and other items will be exported as well.If an output folder was specified, the resulting source files will be stored in a folder hierarchy that matches their namespace or package name.
- Specified by:
processin classDecompilerExporter- Returns:
- true if no error occurred; false if some errors occurred
-
customizeOptions
Description copied from class:DecompilerExporterOptional method used to customize the options of the decompilation context. The custom implementation may modify or set new options. The default implementation does nothing.- Overrides:
customizeOptionsin classDecompilerExporter- Parameters:
decompilingClasses- true if the exporter will decompile classes; false if it will decompile methodsoptbld- the current option builder
-
setSignaturePattern
The strings that will be provided to the matcher are jvm (canonical) class or method signatures, e.g.Lcom/abc/Foo;orLcom/foo/Bar;->m1([I)Ljava/lang/String;.- Overrides:
setSignaturePatternin classDecompilerExporter- Parameters:
pattern- a regex pattern
-
generateMethodFileName
- Overrides:
generateMethodFileNamein classDecompilerExporter
-
generateClassFileName
- Overrides:
generateClassFileNamein classDecompilerExporter
-