Class DecompilerHelper

java.lang.Object
com.pnfsoftware.jeb.core.util.DecompilerHelper

public class DecompilerHelper extends Object
Helper methods related to decompiler units.
  • Method Details

    • typeName

      public static String typeName(String codeUnitType)
      Build the decompiler unit type associated with a code unit type.
      Parameters:
      codeUnitType - the code unit type
      Returns:
      the decompiler unit type for the provided code unit type
    • hasDecompilerFor

      public static boolean hasDecompilerFor(ICodeUnit unit)
      Determine whether or not there is (or could be) an associated decompiler for the provided code unit.
      Parameters:
      unit - the code unit to examine
      Returns:
      true if a matching decompiler already exists or can be created, false otherwise
    • getAvailableDecompilers

      public static List<IUnitIdentifier> getAvailableDecompilers(IEnginesContext engctx)
      Retrieve all registered decompiler unit identifiers.
      Parameters:
      engctx - the engines context
      Returns:
      the available decompiler identifiers
    • isDexDecompilerAvailable

      public static boolean isDexDecompilerAvailable(IEnginesContext engctx)
      Determine whether a Dex decompiler is available in the engines context.
      Parameters:
      engctx - the engines context
      Returns:
      true if a Dex decompiler is available, false otherwise
    • getAvailableDecompilerNames

      public static List<String> getAvailableDecompilerNames(IEnginesContext engctx)
      Retrieve the code unit type names for all registered decompilers.
      Parameters:
      engctx - the engines context
      Returns:
      the supported code unit type names
    • getDecompiler

      public static IDecompilerUnit getDecompiler(IUnit unit)
      Retrieve or create a decompiler for the current unit.
      Parameters:
      unit - the unit for which a related decompiler is requested
      Returns:
      the decompiler unit or null
    • getDecompiler

      public static IDecompilerUnit getDecompiler(IUnit unit, boolean createIfNotExist)
      Retrieve a decompiler for the current unit.
      Parameters:
      unit - a code unit
      createIfNotExist - true to create a decompiler when none already exists
      Returns:
      the decompiler unit or null
    • getRelatedDecompiler

      public static IDecompilerUnit getRelatedDecompiler(IUnit unit)
      Retrieve an existing decompiler for the current code unit or the decompiler that produced the provided source unit. No decompiler is created.
      Parameters:
      unit - a code unit or a source unit
      Returns:
      the decompiler unit or null
    • getRelatedCodeUnit

      public static ICodeUnit getRelatedCodeUnit(IUnit unit)
      Retrieve the existing code unit for the provided decompiler or source unit.
      Parameters:
      unit - a decompiler or source unit
      Returns:
      the related code unit, or null if none can be resolved
    • getBuildTypesWithDecompilationSupport

      public static List<String> getBuildTypesWithDecompilationSupport(String codeUnitType)
      Retrieve the JEB build types that provide decompilation support for a code unit type.
      Parameters:
      codeUnitType - the code unit type
      Returns:
      the supporting build type names, or an empty list if unsupported
    • parsePluginNamesListProperty

      public static Collection<String> parsePluginNamesListProperty(String propertyValue)
      Parse a comma-separated plugin-name property value into a unique set of plugin names.
      Parameters:
      propertyValue - the property value, may be null
      Returns:
      the parsed plugin names, preserving their declaration order
    • createPluginNamesListProperty

      public static String createPluginNamesListProperty(Collection<String> pluginNames)
      Serialize a collection of plugin names into a comma-separated property value.
      Parameters:
      pluginNames - the plugin names, may be null
      Returns:
      the serialized property value, or an empty string if the collection is null
    • createProgressLogger

      public static ProgressCallbackAdapter createProgressLogger()
      Create a progress callback object that logs progress to the global logger, as such: "[current]/[total]: [message]"
      Returns:
      the callback object
    • createProgressLogger

      public static ProgressCallbackAdapter createProgressLogger(ILogger logger, Integer level)
      Create a progress callback object that logs progress to a logger, as such: "[current]/[total]: [message]"
      Parameters:
      logger - optional logger; if null, the global anonymous logger is used
      level - optional level; if null, the informational level is used
      Returns:
      the callback object