Java Throwable to String getStackTrace(Throwable t)

Here you can find the source of getStackTrace(Throwable t)

Description

get Stack Trace

License

Apache License

Parameter

Parameter Description
t a parameter

Declaration

public static String getStackTrace(Throwable t) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.ByteArrayOutputStream;

import java.io.PrintWriter;

public class Main {
    /**//from   w ww  .j av  a  2 s.  c o m
     *
     * @param t
     * @return
     */
    public static String getStackTrace(Throwable t) {
        ByteArrayOutputStream bao = new ByteArrayOutputStream(1024);
        PrintWriter pr = new PrintWriter(bao);
        t.printStackTrace(pr);
        return bao.toString();
    }
}

Related

  1. getStackTrace(Throwable exception)
  2. getStackTrace(Throwable exception)
  3. getStackTrace(Throwable pException)
  4. getStackTrace(Throwable pThrowable_)
  5. getStackTrace(Throwable t)
  6. getStackTrace(Throwable t)
  7. getStackTrace(Throwable t)
  8. getStackTrace(Throwable t)
  9. getStackTrace(Throwable t)