com.flagstone.transform.coder
Class Context

java.lang.Object
  extended by com.flagstone.transform.coder.Context

public class Context
extends Object

Contexts are used to pass information between objects when they are being encoded or decoded.


Field Summary
static int ADVANCE_SIZE
          The number of bit used to encode a glyph advance.
static int ARRAY_EXTENDED
          Arrays of fill or line styles can contain more than 255 entries.
static int COMPRESSED
          Indicates the flash file is compressed.
static int FILL_SIZE
          The number of bit used to encode a fill style selection.
static int GLYPH_SIZE
          The number of bit used to encode a glyph index.
static int LAST
          Indicates that this is the last EventHandler to be encoded/decoded.
static int LINE_SIZE
          The number of bit used to encode a line style selection.
static int MENU_BUTTON
          Indicates a definition is for menu button.
static int POSTSCRIPT
          The glyphs were derived from a Postscript font.
static int SCALING_STROKE
          The line styles define a scaling stroke.
static int SHAPE_SIZE
          The number of bits used to encode a given shape.
static int TRANSPARENT
          Whether the alpha channel should be encoded / decoded.
static int TYPE
          Type identifying the current MovieTag being decoded.
static int VERSION
          Flash Version.
static int WIDE_CODES
          Character codes are 16-bits.
 
Constructor Summary
Context()
          Create a Context object.
 
Method Summary
 boolean contains(Integer key)
          Is a variable set.
 Integer get(Integer key)
          Get the value of a variable.
 String getEncoding()
          Get character encoding scheme used when encoding or decoding strings.
 DecoderRegistry getRegistry()
          Get the registry containing the decoders for different types of objects.
 Context put(Integer key, Integer value)
          Set a variable.
 void remove(Integer key)
          Delete the context variable.
 void setEncoding(String charSet)
          Sets the character encoding scheme used when encoding or decoding strings.
 void setRegistry(DecoderRegistry decoderRegistry)
          Set the registry containing the decoders for different types of objects.
 int strlen(String string)
          Calculates the length of a string when encoded using the specified character set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final int VERSION
Flash Version.

See Also:
Constant Field Values

TYPE

public static final int TYPE
Type identifying the current MovieTag being decoded.

See Also:
Constant Field Values

TRANSPARENT

public static final int TRANSPARENT
Whether the alpha channel should be encoded / decoded.

See Also:
Constant Field Values

WIDE_CODES

public static final int WIDE_CODES
Character codes are 16-bits.

See Also:
Constant Field Values

ARRAY_EXTENDED

public static final int ARRAY_EXTENDED
Arrays of fill or line styles can contain more than 255 entries.

See Also:
Constant Field Values

POSTSCRIPT

public static final int POSTSCRIPT
The glyphs were derived from a Postscript font.

See Also:
Constant Field Values

SCALING_STROKE

public static final int SCALING_STROKE
The line styles define a scaling stroke.

See Also:
Constant Field Values

FILL_SIZE

public static final int FILL_SIZE
The number of bit used to encode a fill style selection.

See Also:
Constant Field Values

LINE_SIZE

public static final int LINE_SIZE
The number of bit used to encode a line style selection.

See Also:
Constant Field Values

ADVANCE_SIZE

public static final int ADVANCE_SIZE
The number of bit used to encode a glyph advance.

See Also:
Constant Field Values

GLYPH_SIZE

public static final int GLYPH_SIZE
The number of bit used to encode a glyph index.

See Also:
Constant Field Values

SHAPE_SIZE

public static final int SHAPE_SIZE
The number of bits used to encode a given shape.

See Also:
Constant Field Values

LAST

public static final int LAST
Indicates that this is the last EventHandler to be encoded/decoded.

See Also:
Constant Field Values

COMPRESSED

public static final int COMPRESSED
Indicates the flash file is compressed.

See Also:
Constant Field Values

MENU_BUTTON

public static final int MENU_BUTTON
Indicates a definition is for menu button.

See Also:
Constant Field Values
Constructor Detail

Context

public Context()
Create a Context object.

Method Detail

getEncoding

public String getEncoding()
Get character encoding scheme used when encoding or decoding strings.

Returns:
the character encoding used for strings.

setEncoding

public void setEncoding(String charSet)
Sets the character encoding scheme used when encoding or decoding strings. If the character set encoding is not supported by the Java environment then an UnsupportedCharsetException will be thrown. If the character set cannot be identified then an IllegalCharsetNameException will be thrown.

Parameters:
charSet - the name of the character set used to encode strings.

strlen

public int strlen(String string)
Calculates the length of a string when encoded using the specified character set.

Parameters:
string - the string to be encoded.
Returns:
the number of bytes required to encode the string plus 1 for a terminating null character.

getRegistry

public DecoderRegistry getRegistry()
Get the registry containing the decoders for different types of objects.

Returns:
the decoder registry.

setRegistry

public void setRegistry(DecoderRegistry decoderRegistry)
Set the registry containing the decoders for different types of objects.

Parameters:
decoderRegistry - the registry containing decoder objects.

contains

public boolean contains(Integer key)
Is a variable set.

Parameters:
key - the name of the variable.
Returns:
true if the variable is set, false if not.

remove

public void remove(Integer key)
Delete the context variable.

Parameters:
key - the identifier for the variable.

get

public Integer get(Integer key)
Get the value of a variable.

Parameters:
key - the name of the variable.
Returns:
the variable value.

put

public Context put(Integer key,
                   Integer value)
Set a variable.

Parameters:
key - the name of the variable.
value - the variable value.
Returns:
this object.


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