/**
* 将异常信息转化成字符串
* @param t
* @return
* @throws IOException
*/
public 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();
}
将Throwable的信息转换为字符串
最新推荐文章于 2023-12-28 16:37:25 发布