将异常堆栈跟踪保存到字符串
//from nowjava - 时 代 Java import java.io.PrintWriter; import java.io.StringWriter; public class Main { public static void main(String args[]) { try { // this will throw NumberFormatException Integer.parseInt("Not a number"); } catch (NumberFormatException e) { StringWriter sWriter = new StringWriter(); PrintWriter pWriter = new PrintWriter(sWriter); e.printStackTrace(pWriter); String strStackTrace = sWriter.toStri