将Java异常信息保存到字符串中,,/** * 将异常信息转
分享于 点击 29446 次 点评:100
将Java异常信息保存到字符串中,,/** * 将异常信息转
/** * 将异常信息转化成字符串 * @param t * @return * @throws IOException */private static String exception(Throwable t) throws IOException{ if(t == null) return null; ByteArrayOutputStream baos = new ByteArrayOutputStream(); try{ t.printStackTrace(new PrintStream(baos)); }finally{ baos.close(); } return baos.toString();}//该片段来自于http://byrx.net
用户点评