com.flagstone.transform
Class Export

java.lang.Object
  extended by com.flagstone.transform.Export
All Implemented Interfaces:
Copyable<MovieTag>, SWFEncodeable, MovieTag

public final class Export
extends Object
implements MovieTag

Export is used to export one or more shapes and other objects so they can be used in another Flash file.

Since the identifier for an object is only unique within a given Flash file, each object exported is assigned a name so it can referenced when it is imported.


Constructor Summary
Export()
          Creates an Export object with an empty map.
Export(Export object)
          Creates and initialises an Export object using the values copied from another Export object.
Export(Map<Integer,String> map)
          Creates an Export object with the specified map.
Export(SWFDecoder coder)
          Creates and initialises an Export object using values encoded in the Flash binary format.
 
Method Summary
 Export add(int uid, String aString)
          Adds the identifier and name to the list of objects to be exported.
 Export copy()
          Creates a complete copy of this object.
 void encode(SWFEncoder coder, Context context)
          Encode an object to the Flash binary format.
 Map<Integer,String> getObjects()
          Get the table of objects to be exported.
 int prepareToEncode(Context context)
          Prepare an object for encoding, returning the expected size of an object when it is encoded.
 void setObjects(Map<Integer,String> aTable)
          Sets the table of objects to be exported.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Export

public Export(SWFDecoder coder)
       throws IOException
Creates and initialises an Export object using values encoded in the Flash binary format.

Parameters:
coder - an SWFDecoder object that contains the encoded Flash data.
Throws:
IOException - if an error occurs while decoding the data.

Export

public Export()
Creates an Export object with an empty map.


Export

public Export(Map<Integer,String> map)
Creates an Export object with the specified map.

Parameters:
map - the table containing identifier/name pairs for the objects that will be exported from the movie.

Export

public Export(Export object)
Creates and initialises an Export object using the values copied from another Export object.

Parameters:
object - a Export object from which the values will be copied.
Method Detail

add

public Export add(int uid,
                  String aString)
Adds the identifier and name to the list of objects to be exported.

Parameters:
uid - the identifier of the object to be exported.
aString - the name of the exported object to allow it to be referenced. The name must not be null or an empty string.
Returns:
this object.

getObjects

public Map<Integer,String> getObjects()
Get the table of objects to be exported.

Returns:
the table of objects mapping identifiers to names.

setObjects

public void setObjects(Map<Integer,String> aTable)
Sets the table of objects to be exported.

Parameters:
aTable - the table of objects being imported. Must not be null.

copy

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

Specified by:
copy in interface Copyable<MovieTag>
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.