Package com.android.utils
Class TraceUtils
- java.lang.Object
-
- com.android.utils.TraceUtils
-
public class TraceUtils extends java.lang.ObjectStatic methods useful for tracing.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringcurrentTime()Returns the current time as a yyyy-MM-dd HH:mm:ss.SSS string.static java.lang.StringgetCurrentStack()Returns the current stack of the caller.static java.lang.StringgetCurrentStack(int numberOfTopFramesToRemove)Returns the current stack of the caller.static java.lang.StringgetSimpleId(java.lang.Object obj)Returns a string consisting of the object's class name without the package part, '@' separator, and the hexadecimal identity hash code, e.g.static java.lang.StringgetStackTrace(java.lang.Throwable t)Returns a stack trace of the given throwable as a string.
-
-
-
Method Detail
-
getCurrentStack
@NonNull public static java.lang.String getCurrentStack()
Returns the current stack of the caller.- Returns:
- the stack as a string
-
getCurrentStack
@NonNull public static java.lang.String getCurrentStack(int numberOfTopFramesToRemove)
Returns the current stack of the caller. Optionally, removes few frames at the top of the stack.- Parameters:
numberOfTopFramesToRemove- the number of top stack frames to remove- Returns:
- the stack as a string
-
getStackTrace
@NonNull public static java.lang.String getStackTrace(@NonNull java.lang.Throwable t)Returns a stack trace of the given throwable as a string.- Parameters:
t- the throwable to get the stack trace from- Returns:
- the string containing the stack trace
-
getSimpleId
@NonNull public static java.lang.String getSimpleId(@Nullable java.lang.Object obj)Returns a string consisting of the object's class name without the package part, '@' separator, and the hexadecimal identity hash code, e.g. AndroidResGroupNode@5A1D1719.
-
currentTime
@NonNull public static java.lang.String currentTime()
Returns the current time as a yyyy-MM-dd HH:mm:ss.SSS string.
-
-