org.jboss.util
Class StackTrace.Parser

java.lang.Object
  extended byorg.jboss.util.StackTrace.Parser
Enclosing class:
StackTrace (src)

public static class StackTrace.Parser
extends java.lang.Object

A parser which takes a standard Throwable and produces StackTrace.Entry (src) objects.


Constructor Summary
StackTrace.Parser()
           
 
Method Summary
protected  StackTrace.Entry (src) createEntry(java.lang.String raw)
          Create a stack trace entry for the given raw trace entry.
protected  java.io.BufferedReader createReader(java.lang.Throwable detail)
          Create a reader for the trace of the given Throwable.
static StackTrace.Parser (src) getInstance()
          Get the stack trace parser for this virtual machine.
 java.util.List parse(java.lang.Throwable detail, int level, int limit)
          Parse a Throwable stack trace.
protected  byte[] readBytes(java.lang.Throwable detail)
          Read a throwable stack trace as an array of bytes.
protected  void setLevel(java.io.BufferedReader reader, int level)
          Skip to the correct level of the stack (going down into the stack).
protected  void skipDescription(java.io.BufferedReader reader)
          Skip the throwable description of the trace.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StackTrace.Parser

public StackTrace.Parser()
Method Detail

skipDescription

protected void skipDescription(java.io.BufferedReader reader)
                        throws java.io.IOException
Skip the throwable description of the trace.

Parameters:
reader - Reader representing the trace.
Throws:
java.io.IOException

setLevel

protected void setLevel(java.io.BufferedReader reader,
                        int level)
                 throws java.io.IOException
Skip to the correct level of the stack (going down into the stack).

Parameters:
reader - Reader representing the stack trace.
level - Number of levels to go down.
Throws:
java.io.IOException

readBytes

protected byte[] readBytes(java.lang.Throwable detail)
                    throws java.io.IOException
Read a throwable stack trace as an array of bytes.

Parameters:
detail - Throwable to get trace from.
Returns:
Throwable stack trace as an array of bytes.
Throws:
java.io.IOException

createReader

protected java.io.BufferedReader createReader(java.lang.Throwable detail)
                                       throws java.io.IOException
Create a reader for the trace of the given Throwable.

Parameters:
detail - Thorwable to get trace from.
Returns:
Reader for the throwable stack trace.
Throws:
java.io.IOException

parse

public java.util.List parse(java.lang.Throwable detail,
                            int level,
                            int limit)
                     throws java.io.IOException
Parse a Throwable stack trace.

Parameters:
detail - Throwable to get trace from.
level - Number of levels down to begin parsing.
limit - The maximum number of entries to parse (does not include skipped levels or the description). A value <= zero results in all entries being parsed.
Returns:
List of StackTrace.Entry (src) objects.
Throws:
java.io.IOException

createEntry

protected StackTrace.Entry (src)  createEntry(java.lang.String raw)
                                throws java.io.IOException
Create a stack trace entry for the given raw trace entry.

Parameters:
raw - Raw stack trace entry.
Returns:
Stack trace entry.
Throws:
java.io.IOException

getInstance

public static final StackTrace.Parser (src)  getInstance()
                                           throws java.lang.InstantiationException
Get the stack trace parser for this virtual machine.

Returns:
Stack trace parser
Throws:
java.lang.InstantiationException