黑马程序员技术交流社区
标题:
将Java异常信息保存到字符串中
[打印本页]
作者:
无云
时间:
2015-8-30 00:49
标题:
将Java异常信息保存到字符串中
/**
* 将异常信息转化成字符串
* 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();
}
作者:
李相斌
时间:
2015-8-30 01:03
哪里复制的代码??
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2