Java Throwable to String getStackTrace(Throwable ex)

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

Description

get Stack Trace

License

Apache License

Declaration

private static StringTokenizer getStackTrace(Throwable ex) 

Method Source Code


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

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.StringTokenizer;

public class Main {
    private static final String LINE_BREAKING = System.lineSeparator();

    private static StringTokenizer getStackTrace(Throwable ex) {
        ByteArrayOutputStream temp = new ByteArrayOutputStream();
        ex.printStackTrace(new PrintStream(temp));
        String stackTrace = new String(temp.toByteArray());
        return new StringTokenizer(stackTrace, LINE_BREAKING);
    }//  w  ww.j a va 2  s  .c  om
}

Related

  1. getStackTrace(Throwable aThrowable)
  2. getStackTrace(Throwable e)
  3. getStackTrace(Throwable e)
  4. getStackTrace(Throwable e)
  5. getStackTrace(Throwable ex)
  6. getStackTrace(Throwable ex)
  7. getStackTrace(Throwable exc)
  8. getStackTrace(Throwable exception)
  9. getStackTrace(Throwable exception)