Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.flagstone.transform
Class FSExceptionHandler

    java.lang.Object
      com.flagstone.transform.FSTransformObject
          com.flagstone.transform.FSActionObject
              com.flagstone.transform.FSExceptionHandler

All Implemented Interfaces:
  java.lang.Cloneable

    public class FSExceptionHandler

extends FSActionObject

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.

# History

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

### FSExceptionHandler

    public FSExceptionHandler(FSCoder coder)

  Construct an FSExceptionHandler object, initialising it with values decoded from an encoded object.

  Parameters:
    `coder` - an FSCoder containing the binary data.

### FSExceptionHandler

    public 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.

  Parameters:
    `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.

### FSExceptionHandler

    public 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.

  Parameters:
    `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.

### FSExceptionHandler

    public FSExceptionHandler(FSExceptionHandler obj)

  Constructs an FSExceptionHandler object by copying values from an existing object.

  Parameters:
    `obj` - an FSExceptionHandler object.

Method Detail

### addToTry

    public void addToTry(FSActionObject anAction)

  Adds the action object to the array of actions for the try block.

  Parameters:
    `anAction` - an action.

### addToCatch

    public void addToCatch(FSActionObject anAction)

  Adds the action object to the array of actions for the catch block.

  Parameters:
    `anAction` - an action.

### addToFinally

    public void addToFinally(FSActionObject anAction)

  Adds the action object to the array of actions for the finally block.

  Parameters:
    `anAction` - an action.

### getVariable

    public java.lang.String getVariable()

  Gets the name of the variable which the exception object is assigned to.

  Returns:
    the name of the function. Returns null if the exception object will be assigned to a register.

### setVariable

    public void setVariable(java.lang.String name)

  Sets the name of the variable that the exception object is assigned to.

  Parameters:
    `name` - the name of the variable. May be null if the exception object will be signed to a register.

### getRegister

    public int getRegister()

  Gets the index of the register that the exception object is assigned to.

  Returns:
    the number of register. Returns 0 if the exception object will be assigned to a local variable.

### setRegister

    public void setRegister(int index)

  Sets the index of the register that the exception object is assigned to.

  Parameters:
    `index` - the number of the register. May be 0 if the exception object will be assigned to a local variable.

### getTryActions

    public java.util.ArrayList getTryActions()

  Gets the array of actions executed in the try block.

  Returns:
    the array of actions for the try block.

### setTryActions

    public void setTryActions(java.util.ArrayList array)

  Sets the array of actions executed in the try block.

  Parameters:
    `array` - the array of actions for the try block.

### getCatchActions

    public java.util.ArrayList getCatchActions()

  Gets the array of actions executed in the catch block.

  Returns:
    the array of actions for the catch block.

### setCatchActions

    public void setCatchActions(java.util.ArrayList array)

  Sets the array of actions executed in the catch block.

  Parameters:
    `array` - the array of actions for the catch block.

### getFinalActions

    public java.util.ArrayList getFinalActions()

  Gets the array of actions executed in the finally block.

  Returns:
    the array of actions for the finally block.

### setFinalActions

    public void setFinalActions(java.util.ArrayList array)

  Sets the array of actions executed in the final block.

  Parameters:
    `array` - the array of actions for the final block.

### clone

    public java.lang.Object clone()

  Description copied from class: `FSTransformObject`
  Creates a deep copy of the entire object.

  Overrides:
    `clone` in class `FSTransformObject`
  Returns:
    a copy of the object.

### equals

    public boolean equals(java.lang.Object anObject)

  Description copied from class: `FSActionObject`
  Returns true if anObject is equal to this one. Objects are considered equal if they would generate identical binary data when they are encoded to a Flash file.

  Overrides:
    `equals` in class `FSActionObject`
  Returns:
    true if this object would be identical to anObject when encoded.

### appendDescription

    public void appendDescription(java.lang.StringBuffer buffer,
                                  int depth)

  Description copied from class: `FSTransformObject`
  AppendDescription is used to present a string description of the object including all nested objects up to a specified depth. This method provide a more controlled way of creating a string representation of an object since large objects such as font or shape definitions can contain dozens of nested objects. The representation of the object is appended to the StringBuffer, showing the name of the class and values of the attributes it contains. If the object contains any attributes that are objects then the object graph will be traversed up to the specified depth. If objects are nested at a level less than specified depth then the full string representation of the object is displayed. For objects at the specified depth only the name of the class is displayed. Any objects below this depth are not displayed.

  Specified by:
    `appendDescription` in class `FSTransformObject`
  Parameters:
    `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.

### length

    public int length(FSCoder coder)

  Overrides:
    `length` in class `FSActionObject`

### encode

    public void encode(FSCoder coder)

  Overrides:
    `encode` in class `FSActionObject`

### decode

    public void decode(FSCoder coder)

  Overrides:
    `decode` in class `FSActionObject`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD