| java.lang.Object org.apache.harmony.vm.VMStack
VMStack | final public class VMStack (Code) | | Provides the methods to get an information about the execution stack. These
methods may be used by different Java APIs such as security classes, SQL
packages, Class, ClassLoader and so on.
Note, that some of the methods do almost the same things, still the different
methods must be used for different tasks to reach the better performance.
This class must be implemented according to the common policy for porting
interfaces - see the porting interface overview for more details.
author: Evgueni Brevnov, Roman S. Bushmanov version: $Revision: 1.1.6.4 $ |
getCallerClass | native public static Class> getCallerClass(int depth)(Code) | | Returns the class from the specified depth in the stack. If the
specified depth is equal to zero then the caller of the caller of this
method should be returned. Reflection stack frames should not be taken
into account.
Parameters: depth - the stack depth to get a caller class from. It is notnegative one. class a class from the stack. If there is no class in specifieddepth, null is returned. |
getClasses | native public static Class[] getClasses(int maxSize, boolean considerPrivileged)(Code) | | Collects and returns the stack of the current thread as an array of
classes. Resulting array should contain maxSize elements at the maximum.
Note that reflection stack frames should not be taken into account. The
caller of the caller of the caller of this method is stored as a first
element of the array. If considerPrivileged is true then the last
element of the array should be the caller of the most recent privileged
method.
This method may be used by security checks implementation. It is not
supposed to be used by Throwable class.
Parameters: maxSize - maximum size of resulting array. If maxSize is less thanzero array may contain any number of elements. Parameters: considerPrivileged - indicates that privileged methods should betaken into account. It means if considerPrivileged is true thelast element of resulting array should be the caller of the mostrecent privileged method. If considerPrivileged is false thenprivileged methods don't affect resulting array. a stack of invoked methods as an array of classes. |
getStackClasses | native public static Class[] getStackClasses(Object state)(Code) | | Collects and returns the classes of invoked methods as an array of the
Class objects. This method may be used by
java.lang.Throwable class implementation.
Resulting stack should contain native stack frames as well as reflection
stack frames.
Note, that it returns classes for all stack, without any checks.
It's fast, simple version of
VMStack.getClasses VMStack.getClasses() method, and used from Throwable class implementation.
Parameters: state - handler returned by theVMStack.getStackState VMStack.getStackState() method. array of Class elements. If stack isempty then null should be returned. |
getStackState | native public static Object getStackState()(Code) | | Saves stack information of currently executing thread. Returned object
can be used as a handler to obtain an array of
java.lang.StackTraceElement by means of the
VMStack.getStackTrace VMStack.getStackTrace() method.
handler of the current stack. |
getStackTrace | native public static StackTraceElement[] getStackTrace(Object state)(Code) | | Collects and returns the stack of invoked methods as an array of the
StackTraceElement objects. This method may be used by
java.lang.Throwable class implementation.
Resulting stack should contain native stack frames as well as reflection
stack frames.
Note, that stack frames corresponding to exception creation should
be excluded form the resulting array. The most top (recently invoked)
method is stored as a first element of the array.
Parameters: state - handler returned by theVMStack.getStackState VMStack.getStackState() method. array of StackTraceElement elements. If stack isempty then array of length 0 should be returned. |
|
|