Class CodeUtils

java.lang.Object
jadx.api.utils.CodeUtils

public class CodeUtils extends Object
  • Constructor Details

    • CodeUtils

      public CodeUtils()
  • Method Details

    • getLineForPos

      public static String getLineForPos(String code, int pos)
    • getLineStartForPos

      public static int getLineStartForPos(String code, int pos)
    • getLineEndForPos

      public static int getLineEndForPos(String code, int pos)
    • getNewLinePosAfter

      public static int getNewLinePosAfter(String code, int startPos)
    • getNewLinePosBefore

      public static int getNewLinePosBefore(String code, int startPos)
    • getLineNumForPos

      public static int getLineNumForPos(String code, int pos, String newLine)
    • extractMethodCode

      public static String extractMethodCode(MethodNode mth, ICodeInfo codeInfo)
      Cut method code (including comments and annotations) from class code.
      Returns:
      method code or empty string if metadata is not available
    • getMethodStart

      private static int getMethodStart(MethodNode mth, ICodeInfo codeInfo)
      Search first empty line before method definition to include comments and annotations
    • getMethodEnd

      public static int getMethodEnd(MethodNode mth, ICodeInfo codeInfo)
      Search method end position in provided class code info.
      Returns:
      end pos or -1 if metadata not available