Java Throwable to String stackTraceToCharSequence( final Throwable error)

Here you can find the source of stackTraceToCharSequence( final Throwable error)

Description

stack Trace To Char Sequence

License

Open Source License

Declaration

public static CharSequence stackTraceToCharSequence(
            final Throwable error) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.PrintWriter;
import java.io.StringWriter;

public class Main {
    public static CharSequence stackTraceToCharSequence(
            final Throwable error) {
        final StringWriter sw = new StringWriter();
        final PrintWriter pw = new PrintWriter(sw);
        error.printStackTrace(pw);/*from ww  w  .  jav a  2s.  co m*/
        pw.flush();
        return sw.getBuffer();
    }
}

Related

  1. stackTraceFor(final Throwable exception)
  2. stackTraceFromException(Throwable ex)
  3. stackTraceFromThrowable(Throwable throwable)
  4. stackTraceOf(Throwable e)
  5. stackTraceString(final Throwable exception)
  6. stackTraceToHTMLString(Throwable t)
  7. stackTraceToString(final Throwable t)
  8. stackTraceToString(final Throwable thr)
  9. stackTraceToString(final Throwable throwable, final boolean expectNull)