📄 throwablelib.java
字号:
package com.croftsoft.core.lang;
import java.io.*;
/*********************************************************************
* A collection of static methods to manipulate java.lang.Throwable.
*
* @version
* 2001-05-18
* @since
* 2001-05-18
* @author
* <a href="http://www.alumni.caltech.edu/~croft/">David W. Croft</a>
*********************************************************************/
public final class ThrowableLib
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
{
public static void main ( String [ ] args )
//////////////////////////////////////////////////////////////////////
{
System.out.println ( getStackTrace ( new RuntimeException ( ) ) );
}
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
/*********************************************************************
* Returns the stack trace as a String.
*********************************************************************/
public static String getStackTrace ( Throwable throwable )
//////////////////////////////////////////////////////////////////////
{
StringWriter stringWriter = new StringWriter ( );
PrintWriter printWriter = new PrintWriter ( stringWriter );
throwable.printStackTrace ( printWriter );
return stringWriter.toString ( );
}
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
private ThrowableLib ( ) { }
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -