FileDocCategorySizeDatePackage
ThrowableToString.javaAPI DocGlassfish v2 API3093Fri May 04 22:34:10 BST 2007com.sun.enterprise.admin.util

ThrowableToString

public final class ThrowableToString extends Object
Exists to convert a Throwable to a String. This gives more control than having a printStackTrace() go directly to a PrintStream or PrintWriter. It also defers the conversion to a String until a later time when the caller finds it convenient.

Fields Summary
private static final int
kDefaultBufferSize
private final Throwable
mThrowable
Constructors Summary
public ThrowableToString(Throwable throwable)
Constructor--takes any non-null Throwable

param
throwable any Throwable

	
			   				 	 	 
		 
	    
	
		Assert.assertit( throwable != null, "null throwable" );
		mThrowable	= throwable;
	
Methods Summary
public java.lang.StringtoString()
Convert the Throwable to a String.

    	final ByteArrayOutputStream	output	=
    								new ByteArrayOutputStream( kDefaultBufferSize );
    	final PrintStream		print	= new PrintStream( output );
    	
        mThrowable.printStackTrace( print );
        
        return( output.toString() );