Package cn.sliew.milky.common.exception
Class ThrowableTraceFormater
- java.lang.Object
-
- cn.sliew.milky.common.exception.ThrowableTraceFormater
-
public final class ThrowableTraceFormater extends Object
Utilities for dealing with throwables, stacks, etc.
-
-
Constructor Summary
Constructors Constructor Description ThrowableTraceFormater()Default stack traces, no filtering.ThrowableTraceFormater(List<String> filteredPrefixes)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringformatStackTrace(Iterable<StackTraceElement> stackTrace)StringformatStackTrace(StackTraceElement[] stackTrace)StringBuilderformatStackTrace(StringBuilder b, Iterable<StackTraceElement> stackTrace)Format a list of stack entries into a string.StringBuilderformatStackTrace(StringBuilder b, StackTraceElement[] stackTrace)Format a list of stack entries into a string.StringBuilderformatThrowable(StringBuilder b, Throwable t)Format an exception and all of its nested stacks into a string.StringformatThrowable(Throwable t)Format an exception and all of its nested stacks into a string.static StringreadStackTrace(Throwable throwable)Read the stacktrace of the suppliedThrowableinto a String.
-
-
-
Method Detail
-
readStackTrace
public static String readStackTrace(Throwable throwable)
Read the stacktrace of the suppliedThrowableinto a String.- Parameters:
throwable- theThrowableto be examined- Returns:
- the stack trace as generated by
Throwable.printStackTrace(java.io.PrintWriter)method.
-
formatThrowable
public String formatThrowable(Throwable t)
Format an exception and all of its nested stacks into a string.
-
formatThrowable
public StringBuilder formatThrowable(StringBuilder b, Throwable t)
Format an exception and all of its nested stacks into a string.
-
formatStackTrace
public StringBuilder formatStackTrace(StringBuilder b, StackTraceElement[] stackTrace)
Format a list of stack entries into a string.
-
formatStackTrace
public String formatStackTrace(StackTraceElement[] stackTrace)
-
formatStackTrace
public String formatStackTrace(Iterable<StackTraceElement> stackTrace)
-
formatStackTrace
public StringBuilder formatStackTrace(StringBuilder b, Iterable<StackTraceElement> stackTrace)
Format a list of stack entries into a string.
-
-