Example usage for java.lang StackTraceElement getMethodName

List of usage examples for java.lang StackTraceElement getMethodName

Introduction

In this page you can find the example usage for java.lang StackTraceElement getMethodName.

Prototype

public String getMethodName() 

Source Link

Document

Returns the name of the method containing the execution point represented by this stack trace element.

Usage

From source file:Main.java

public static void main(String[] args) {

    Thread t = Thread.currentThread();
    StackTraceElement e = t.getStackTrace()[0];
    System.out.println(e.getMethodName());
}

From source file:com.taobao.android.apatch.ApkPatch.java

public static void main(String[] args) throws IOException, PatchException {

    String baseDir = "/Users/lilong/Downloads/tpatch/";
    File from = new File(baseDir + "classes.dex");
    File to = new File(baseDir + "classes1.dex");

    File out = new File(baseDir);
    // FileUtils.cleanDirectory(out);

    String keystore = "/Users/seker/programs/debugsign/seker.keystore";
    String password = "12345678";
    String alias = "seker.keystore";
    String entry = "12345678";
    String name = "main";
    //        APatchTool.mappingFile = new File("/Users/lilong/Downloads/mapping.txt/target/proguard/full-mapping.txt");
    ApkPatch apkPatch = new ApkPatch(from, to, name, out);
    apkPatch.setDiffFile(new File(baseDir, "diff.txt"));
    StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace();
    for (StackTraceElement stackTraceElement : stackTraceElements) {
        System.out.println(stackTraceElement.getClassName() + ":" + stackTraceElement.getMethodName());
    }//from www  .ja  v a  2  s  .c  om
    apkPatch.doPatch();
}

From source file:Main.java

private static boolean isScreenShotMethodChanged(StackTraceElement element) {
    if (element.getMethodName().equals(preMethodName)) {
        return false;
    }/* ww w. j ava 2 s .  c  om*/
    return true;
}

From source file:Main.java

public static void trace(StackTraceElement e[]) {
    boolean doNext = false;
    for (StackTraceElement s : e) {
        if (doNext) {
            System.out.println(s.getMethodName());
            return;
        }/*from w w  w .j  av a  2 s  .  co  m*/
        doNext = s.getMethodName().equals("getStackTrace");
    }
}

From source file:Main.java

private static String getMethod() {
    StackTraceElement[] stacks = new Throwable().getStackTrace();
    StackTraceElement currentStack = stacks[2];
    return currentStack.getMethodName();
}

From source file:Main.java

public static void method_end() {
    Throwable t = new Throwable();
    StackTraceElement e = t.getStackTrace()[2];
    Log.d(e.getClassName(), e.getMethodName() + ": end");
}

From source file:Main.java

public static void method_start() {
    Throwable t = new Throwable();
    StackTraceElement e = t.getStackTrace()[2];
    Log.d(e.getClassName(), e.getMethodName() + ": start");
}

From source file:Main.java

public static String _FUNC_() {
    StackTraceElement traceElement = ((new Exception()).getStackTrace())[1];
    return traceElement.getMethodName();
}

From source file:Main.java

private static String getCallOrginMethodName() {
    StackTraceElement origin = getCallOriginStackTraceElement();
    return origin.getMethodName();
}

From source file:Main.java

public static String getMethod(int N) {
    StackTraceElement ste = Thread.currentThread().getStackTrace()[N];
    return ste.getMethodName();
}