Java convert stack trace to string

Convert java stack trace to string.

public class StackTraceReader
{
	public static String readStackTrace(Throwable e)
  {
        StringWriter stringWriter = new StringWriter();
        PrintWriter printWriter = new PrintWriter(stringWriter);
        e.printStackTrace(printWriter);
        return stringWriter.toString();
    }
}

java