com.flagstone.transform.action
Class Push

java.lang.Object
  extended by com.flagstone.transform.action.Push
All Implemented Interfaces:
Action, Copyable<Action>, SWFEncodeable

public final class Push
extends Object
implements Action

Push is used to push values on the Flash Player's internal stack.

Push supports the full range of data types supported by Flash:

Boolean A boolean value, 1 (true) or 0 (false).
Integer A signed 32-bit integer, range -2,147,483,648 to 2,147,483,647.
Double A double-precision (64-bit) floating-point number, range approximately +/- 1.79769313486231570E+308.
String A String. The string is encoded as using the UTF-8 encoding which is backward compatible with ASCII encoding supported in Flash 5.
Register Index The number (0..255) of one of the Flash player's internal registers.
Table Index An index into a table of string literals defined using the Table action.
Null A null value.
Void A void value.
Movie Clip Property A reserved number used to identify a specific property of a movie clip.
Player Property A reserved number used to identify a specific property of the Flash Player.

See Also:
Null, Property, RegisterIndex, TableIndex, Void

Nested Class Summary
static class Push.Builder
          The Builder class is used to generate a new Push object.
 
Constructor Summary
Push(List<Object> list)
          Creates a Push action that will push the values in the list onto the stack.
Push(Push object)
          Creates and initialises a Push action using the values copied from another Push action.
Push(SWFDecoder coder, Context context)
          Creates and initialises a Push action using values encoded in the Flash binary format.
 
Method Summary
 Push copy()
          Creates a complete copy of this object.
 void encode(SWFEncoder coder, Context context)
          Encode an object to the Flash binary format.
 List<Object> getValues()
          Get the list of values that will be pushed onto the Flash Player's stack.
 int prepareToEncode(Context context)
          Prepare an object for encoding, returning the expected size of an object when it is encoded.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Push

public Push(SWFDecoder coder,
            Context context)
     throws IOException
Creates and initialises a Push action using values encoded in the Flash binary format.

Parameters:
coder - an SWFDecoder object that contains the encoded Flash data.
context - a Context object used to manage the decoders for different type of object and to pass information on how objects are decoded.
Throws:
IOException - if an error occurs while decoding the data.

Push

public Push(List<Object> list)
Creates a Push action that will push the values in the list onto the stack.

Parameters:
list - a list of values to be pushed onto the stack. The values must be one of the following classes: Boolean, Integer, Double, String, RegisterIndex or TableIndex. Must not be null.

Push

public Push(Push object)
Creates and initialises a Push action using the values copied from another Push action.

Parameters:
object - a Push action from which the values will be copied. References to immutable objects will be shared.
Method Detail

getValues

public List<Object> getValues()
Get the list of values that will be pushed onto the Flash Player's stack.

Returns:
a copy of the list of values.

copy

public Push copy()
Creates a complete copy of this object.

Specified by:
copy in interface Copyable<Action>
Returns:
a deep-copy of this object. New instances of mutable objects are copied and immutable instances are shared.

toString

public String toString()

Overrides:
toString in class Object

prepareToEncode

public int prepareToEncode(Context context)
Prepare an object for encoding, returning the expected size of an object when it is encoded. This method also used to initialise variables, such as offsets and flags that will be used when the object is encoded. Generally the method returns the size in bytes, however when called on objects that use bit fields such as shapes the methods will return the size in bits.

Specified by:
prepareToEncode in interface SWFEncodeable
Parameters:
context - an Context that allows information to be passed between objects to control how they are initialised for encoding.
Returns:
the size of the object when it is encoded.

encode

public void encode(SWFEncoder coder,
                   Context context)
            throws IOException
Encode an object to the Flash binary format.

Specified by:
encode in interface SWFEncodeable
Parameters:
coder - an SWFEncoder object.
context - an Context that allows information to be passed between objects to control how they are initialised for encoding.
Throws:
IOException - if an error occurs while encoding the object.


Copyright © 2002-2010 Flagstone Software Ltd.. All Rights Reserved.