com.flagstone.transform.action
Class ActionData

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

public final class ActionData
extends Object
implements Action

ActionData is used to store one or more actions which already have been encoded for writing to a Flash file.

You can use this class to reduce the time it takes to decode and encode a movie. By selectively decoding the actions in a movie, actions that are not of interest can be left encoded. Similarly selectively encoding actions that will not change will improve performance when generating files using a movie as a template.


Constructor Summary
ActionData(ActionData object)
          Creates a copy of this ActionData object.
ActionData(byte[] bytes)
          Creates an ActionData object initialised with a set of encoded actions.
 
Method Summary
 ActionData copy()
          Creates a complete copy of this object.
 void encode(SWFEncoder coder, Context context)
          Encode an object to the Flash binary format.
 byte[] getData()
          Creates and returns a copy of the encoded actions.
 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

ActionData

public ActionData(byte[] bytes)
Creates an ActionData object initialised with a set of encoded actions.

Parameters:
bytes - the encoded actions. Must not be null or empty.

ActionData

public ActionData(ActionData object)
Creates a copy of this ActionData object.

Parameters:
object - the ActionData object used to initialise this one.
Method Detail

getData

public byte[] getData()
Creates and returns a copy of the encoded actions.

Returns:
a copy of the encoded actions.

copy

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