com.flagstone.transform.image
Class JPEGEncodingTable

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

public final class JPEGEncodingTable
extends Object
implements MovieTag

JPEGEncodingTable defines the Huffman encoding table for JPEG images.

The encoding table is shared between all images defined using the DefineJPEGImage class so there should only be one JPEGEncodingTable object defined in a movie.

The JPEGEncodingTable class is not essential to define JPEG encoded images in a movie using the DefineJPEGImage class. You can still display an image if it contains the encoding table. There is no need to separate it and add it to a JPEGEncodingTable object, particularly since different images contain different encoding tables.

See Also:
DefineJPEGImage

Constructor Summary
JPEGEncodingTable(byte[] bytes)
          Creates a JPEGEncodingTable object with the encoding table data.
JPEGEncodingTable(JPEGEncodingTable object)
          Creates and initialises a JPEGEncodingTable object using the values copied from another JPEGEncodingTable object.
JPEGEncodingTable(SWFDecoder coder)
          Creates and initialises a JPEGEncodingTable object using values encoded in the Flash binary format.
 
Method Summary
 JPEGEncodingTable copy()
          Creates a complete copy of this object.
 void encode(SWFEncoder coder, Context context)
          Encode an object to the Flash binary format.
 byte[] getTable()
          Get a copy of the encoding table.
 int prepareToEncode(Context context)
          Prepare an object for encoding, returning the expected size of an object when it is encoded.
 void setTable(byte[] bytes)
          Sets the encoding table.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JPEGEncodingTable

public JPEGEncodingTable(SWFDecoder coder)
                  throws IOException
Creates and initialises a JPEGEncodingTable 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.

JPEGEncodingTable

public JPEGEncodingTable(byte[] bytes)
Creates a JPEGEncodingTable object with the encoding table data.

Parameters:
bytes - a list of bytes contains the data for the encoding table. Must not be null.

JPEGEncodingTable

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

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

getTable

public byte[] getTable()
Get a copy of the encoding table.

Returns:
a copy of the table data.

setTable

public void setTable(byte[] bytes)
Sets the encoding table.

Parameters:
bytes - a list of bytes contains the data for the encoding table. Must not be null or zero length.

copy

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