Java Throwable to String stackTraceString(final Throwable exception)

Here you can find the source of stackTraceString(final Throwable exception)

Description

stack Trace String

License

Open Source License

Declaration

public static String stackTraceString(final Throwable exception) 

Method Source Code

//package com.java2s;
/*-/*from w  w w  . j a  v a 2 s  . c  o  m*/
 * See the file LICENSE for redistribution information.
 *
 * Copyright (c) 2002, 2014 Oracle and/or its affiliates.  All rights reserved.
 *
 */

import java.io.ByteArrayOutputStream;

import java.io.PrintStream;

public class Main {
    public static String stackTraceString(final Throwable exception) {
        ByteArrayOutputStream bao = new ByteArrayOutputStream();
        PrintStream printStream = new PrintStream(bao);
        exception.printStackTrace(printStream);
        String stackTraceString = bao.toString();
        return stackTraceString;
    }
}

Related

  1. stacktraceError(Throwable e)
  2. stackTraceFor(final Throwable exception)
  3. stackTraceFromException(Throwable ex)
  4. stackTraceFromThrowable(Throwable throwable)
  5. stackTraceOf(Throwable e)
  6. stackTraceToCharSequence( final Throwable error)
  7. stackTraceToHTMLString(Throwable t)
  8. stackTraceToString(final Throwable t)
  9. stackTraceToString(final Throwable thr)