|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.flagstone.transform.FSTransformObject
com.flagstone.transform.FSActionObject
com.flagstone.transform.FSExceptionHandler
public class FSExceptionHandler
The FSExceptionHandler class is used to specify try..catch blocks so exceptions can be thrown and handled when executing a series of actions.
Attributes | |
---|---|
type | Identifies the data structure when it is encoded. Read-only. |
register | The number of the register that the thrown object will be assigned to. Optional, Omitted if the variable attribute is set. |
variable | The variable in memory that the thrown object will be assigned to. Optional, Omitted if the register attribute is set. |
tryActions | The actions executed in the try block of the exception. |
catchActions | The actions executed in the catch block of the exception. Defining actions for the catch block is optional and may be set to the null object or an empty array if no actions will be executed. |
finalActions | The actions executed in a finally block of the exception. Defining actions for the finally block is optional and may be set to the null object or an empty array if no actions will be executed. |
The thrown object can be assigned to either one of the Flash Player's 256 internal registers or to a variable in memory. If a register number is set the variable name is set to null. Similarly if a variable name is set then the register number is set to zero.
The FSExceptionHandler class contains three arrays of actions supporting the standard syntax for an exception with try, catch and finally blocks. An exception is thrown by a Throw action which pops a value off the stack and assigns it to either a named variable or one of the Flash Player's internal registered so it can be processed by the actions in the catch block.
Exceptions may be nest to any level if a thrown exception is not handled by the immediate catch block it is propagated to the next handler in the exception hierarchy and so on until it is caught.
Both the catch and finally blocks are optional when defining an exception, the corresponding arguments in constructors and accessor methods may be set to null.
The FSExceptionHandler represents the Try action introduced in Flash 7 and is used to directly support the exception handling syntax defined in ActionScript 2.0.
Field Summary |
---|
Fields inherited from class com.flagstone.transform.FSActionObject |
---|
Call, ExceptionHandler, GetUrl, GetUrl2, GotoFrame, GotoFrame2, GotoLabel, If, Jump, length, NewFunction, NewFunction2, Push, RegisterCopy, SetTarget, Table, type, WaitForFrame, WaitForFrame2, With |
Constructor Summary | |
---|---|
FSExceptionHandler(FSCoder coder)
Construct an FSExceptionHandler object, initialising it with values decoded from an encoded object. |
|
FSExceptionHandler(FSExceptionHandler obj)
Constructs an FSExceptionHandler object by copying values from an existing object. |
|
FSExceptionHandler(int index,
java.util.ArrayList tryArray,
java.util.ArrayList catchArray,
java.util.ArrayList finallyArray)
Constructs a new exception handler with the thrown object assigned to one of the Flash Player's internal registers. |
|
FSExceptionHandler(java.lang.String name,
java.util.ArrayList tryArray,
java.util.ArrayList catchArray,
java.util.ArrayList finallyArray)
Constructs a new exception handler with the thrown object assigned to a local variable. |
Method Summary | |
---|---|
void |
addToCatch(FSActionObject anAction)
Adds the action object to the array of actions for the catch block. |
void |
addToFinally(FSActionObject anAction)
Adds the action object to the array of actions for the finally block. |
void |
addToTry(FSActionObject anAction)
Adds the action object to the array of actions for the try block. |
void |
appendDescription(java.lang.StringBuffer buffer,
int depth)
AppendDescription is used to present a string description of the object including all nested objects up to a specified depth. |
java.lang.Object |
clone()
Creates a deep copy of the entire object. |
void |
decode(FSCoder coder)
|
void |
encode(FSCoder coder)
|
boolean |
equals(java.lang.Object anObject)
Returns true if anObject is equal to this one. |
java.util.ArrayList |
getCatchActions()
Gets the array of actions executed in the catch block. |
java.util.ArrayList |
getFinalActions()
Gets the array of actions executed in the finally block. |
int |
getRegister()
Gets the index of the register that the exception object is assigned to. |
java.util.ArrayList |
getTryActions()
Gets the array of actions executed in the try block. |
java.lang.String |
getVariable()
Gets the name of the variable which the exception object is assigned to. |
int |
length(FSCoder coder)
|
void |
setCatchActions(java.util.ArrayList array)
Sets the array of actions executed in the catch block. |
void |
setFinalActions(java.util.ArrayList array)
Sets the array of actions executed in the final block. |
void |
setRegister(int index)
Sets the index of the register that the exception object is assigned to. |
void |
setTryActions(java.util.ArrayList array)
Sets the array of actions executed in the try block. |
void |
setVariable(java.lang.String name)
Sets the name of the variable that the exception object is assigned to. |
Methods inherited from class com.flagstone.transform.FSActionObject |
---|
getType, length |
Methods inherited from class com.flagstone.transform.FSTransformObject |
---|
name, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FSExceptionHandler(FSCoder coder)
coder
- an FSCoder containing the binary data.public FSExceptionHandler(java.lang.String name, java.util.ArrayList tryArray, java.util.ArrayList catchArray, java.util.ArrayList finallyArray)
name
- the name of the variable that the thrown object will be
assigned to.tryArray
- actions that will be executed in the try block of the
exception.catchArray
- actions that will be executed in the catch block of the
exception, if one is defined. This may be null is no catch
block is required - the exception will be handled by another
catche block higher in the exception tree.finallyArray
- actions that will be executed in the finally block of the
exception, if one is defined. This may be null is no finally
block is required.public FSExceptionHandler(int index, java.util.ArrayList tryArray, java.util.ArrayList catchArray, java.util.ArrayList finallyArray)
index
- the number of the register that the thrown object will be
assigned to.tryArray
- actions that will be executed in the try block of the
exception.catchArray
- actions that will be executed in the catch block of the
exception, if one is defined. This may be null is no catch
block is required - the exception will be handled by another
catche block higher in the exception tree.finallyArray
- actions that will be executed in the finally block of the
exception, if one is defined. This may be null is no finally
block is required.public FSExceptionHandler(FSExceptionHandler obj)
obj
- an FSExceptionHandler object.Method Detail |
---|
public void addToTry(FSActionObject anAction)
anAction
- an action.public void addToCatch(FSActionObject anAction)
anAction
- an action.public void addToFinally(FSActionObject anAction)
anAction
- an action.public java.lang.String getVariable()
public void setVariable(java.lang.String name)
name
- the name of the variable. May be null if the exception object
will be signed to a register.public int getRegister()
public void setRegister(int index)
index
- the number of the register. May be 0 if the exception object
will be assigned to a local variable.public java.util.ArrayList getTryActions()
public void setTryActions(java.util.ArrayList array)
array
- the array of actions for the try block.public java.util.ArrayList getCatchActions()
public void setCatchActions(java.util.ArrayList array)
array
- the array of actions for the catch block.public java.util.ArrayList getFinalActions()
public void setFinalActions(java.util.ArrayList array)
array
- the array of actions for the final block.public java.lang.Object clone()
FSTransformObject
clone
in class FSTransformObject
public boolean equals(java.lang.Object anObject)
FSActionObject
equals
in class FSActionObject
public void appendDescription(java.lang.StringBuffer buffer, int depth)
FSTransformObject
appendDescription
in class FSTransformObject
buffer
- a StringBuffer to which the description of each object is
appended.depth
- the maximum level of nesting up to which objects will be
displayed.public int length(FSCoder coder)
length
in class FSActionObject
public void encode(FSCoder coder)
encode
in class FSActionObject
public void decode(FSCoder coder)
decode
in class FSActionObject
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |