List of utility methods to do Throwable to String
String | stackTraceFromThrowable(Throwable throwable) stack Trace From Throwable StringWriter stringWriter = new StringWriter(); throwable.printStackTrace(new PrintWriter(stringWriter)); return stringWriter.toString(); |
String | stackTraceOf(Throwable e) stack Trace Of ByteArrayOutputStream output = new ByteArrayOutputStream(); e.printStackTrace(new PrintStream(output)); return output.toString(); |
String | stackTraceString(final Throwable exception) stack Trace String ByteArrayOutputStream bao = new ByteArrayOutputStream(); PrintStream printStream = new PrintStream(bao); exception.printStackTrace(printStream); String stackTraceString = bao.toString(); return stackTraceString; |
CharSequence | stackTraceToCharSequence(final Throwable error) stack Trace To Char Sequence final StringWriter sw = new StringWriter(); final PrintWriter pw = new PrintWriter(sw); error.printStackTrace(pw); pw.flush(); return sw.getBuffer(); |
String | stackTraceToHTMLString(Throwable t) stack Trace To HTML String return stackTraceToHTMLString(t, " ", "<br>"); |
String | stackTraceToString(final Throwable t) Convert a stack trace of an exception into a string. if (t == null) { return null; final StringWriter sw = new StringWriter(); t.printStackTrace(new PrintWriter(sw)); return sw.toString(); |
String | stackTraceToString(final Throwable thr) stack Trace To String final ByteArrayOutputStream baos = new ByteArrayOutputStream(); thr.printStackTrace(new PrintStream(baos)); return baos.toString(); |
String | stackTraceToString(final Throwable throwable, final boolean expectNull) Returns a stack trace of the Throwable as a String . if (throwable == null) { if (expectNull == true) { return null; return ""; StringWriter stringWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(stringWriter); ... |
String | stackTraceToString(Throwable cause) Gets the stack trace from a Throwable as a String. ByteArrayOutputStream out = new ByteArrayOutputStream(); PrintStream pout = new PrintStream(out); cause.printStackTrace(pout); pout.flush(); try { return new String(out.toByteArray()); } finally { try { ... |
String | stackTraceToString(Throwable cause) stack Trace To String ByteArrayOutputStream out = new ByteArrayOutputStream(); PrintStream pout = new PrintStream(out); cause.printStackTrace(pout); pout.flush(); try { return new String(out.toByteArray()); } finally { try { ... |