flex.messaging.io.amfx
Class AmfxOutput

java.lang.Object
  extended by flex.messaging.io.amf.AbstractAmfOutput
      extended by flex.messaging.io.amfx.AmfxOutput
All Implemented Interfaces:
ActionMessageOutput, AmfxTypes, DataOutput, ObjectOutput

public class AmfxOutput
extends AbstractAmfOutput
implements AmfxTypes

Serializes Java types to ActionScript 3 types via AMFX, an XML based representation of AMF 3.

XML is formatted using using UTF-8 encoding.

See Also:
AmfxMessageSerializer, AmfxInput

Field Summary
 
Fields inherited from interface flex.messaging.io.amfx.AmfxTypes
AMFX_CLOSE_TAG, AMFX_OPEN_TAG, AMFX_TYPE, ARRAY_CLOSE_TAG, ARRAY_OPEN_TAG, ARRAY_TYPE, AVM_PLUS_XML_TYPE, BODY_CLOSE_TAG, BODY_OPEN_TAG, BODY_TYPE, BYTE_ARRAY_CLOSE_TAG, BYTE_ARRAY_OPEN_TAG, BYTE_ARRAY_TYPE, DATE_CLOSE_TAG, DATE_OPEN_TAG, DATE_TYPE, DOUBLE_CLOSE_TAG, DOUBLE_OPEN_TAG, DOUBLE_TYPE, EMPTY_STRING_TAG, EMPTY_TRAITS_TAG, FALSE_TAG, FALSE_TYPE, HEADER_CLOSE_TAG, HEADER_OPEN_TAG, HEADER_TYPE, INTEGER_CLOSE_TAG, INTEGER_OPEN_TAG, INTEGER_TYPE, ITEM_CLOSE_TAG, ITEM_OPEN_TAG, ITEM_TYPE, NULL_TAG, NULL_TYPE, OBJECT_CLOSE_TAG, OBJECT_OPEN_TAG, OBJECT_TYPE, REF_TYPE, STRING_CLOSE_TAG, STRING_OPEN_TAG, STRING_TYPE, TRAITS_CLOSE_TAG, TRAITS_EXTERNALIZALBE_TAG, TRAITS_OPEN_TAG, TRAITS_TYPE, TRUE_TAG, TRUE_TYPE, UNDEFINED_TAG, UNDEFINED_TYPE, UTF_8, XML_CLOSE_TAG, XML_DOC_CLOSE_TAG, XML_DOC_OPEN_TAG, XML_OPEN_TAG, XML_TYPE
 
Constructor Summary
AmfxOutput(SerializationContext context)
           
 
Method Summary
 void reset()
          Clear all object reference information so that the instance can be used to deserialize another data structure.
 void setDebugTrace(AmfTrace trace)
          Turns on "trace" debugging for AMF responses.
 void writeObject(Object o)
          A convenient entry point for writing out any Object for conversion to ActionScript.
 void writeObjectEnd()
           
 void writeObjectProperty(String name, Object value)
           
 void writeObjectTraits(TraitsInfo ti)
           
 void writeUTF(String s)
          
 
Methods inherited from class flex.messaging.io.amf.AbstractAmfOutput
close, flush, setOutputStream, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AmfxOutput

public AmfxOutput(SerializationContext context)
Method Detail

reset

public void reset()
Clear all object reference information so that the instance can be used to deserialize another data structure. Reset should be called before reading a top level object, such as a new header or a new body.


writeObject

public void writeObject(Object o)
                 throws IOException
Description copied from interface: ActionMessageOutput
A convenient entry point for writing out any Object for conversion to ActionScript. The Java class type of the Object will determine the corresponding ActionScript type that will be specified in the AMF stream.

The following is a guide to the Java to ActionScript type mappings:

Java TypeActionScript Type (AMF 0)ActionScript Type (AMF 3 / AMFX)
java.lang.StringStringString
java.lang.BooleanBooleanBoolean
java.lang.Integer
java.lang.Short
java.lang.Byte
Numberint(a)
java.lang.Double
java.lang.Long
java.lang.Float
NumberNumber
java.util.Calendar
java.util.Date
Date(b)Date(b)
java.lang.Character
java.lang.Character[]
StringString
java.lang.Byte[]Array (of Numbers)ByteArray
java.util.Collectionmx.collections.ArrayCollection(c)mx.collections.ArrayCollection(c)
java.lang.Object[] (Native Array)ArrayArray
java.util.Map
java.util.Dictionary
Object(d)Object(d)
java.lang.Object (Other than the above)Typed Object(e)Typed Object(e)
nullnullnull

(a) - For AMF 3 ints, taking sign into consideration, if i < 0xF0000000 || i > 0x0FFFFFFF. then value is promoted to Number.
(b) - Dates are sent in the UTC timezone. Clients and servers must adjust time accordingly for timezones.
(c) - Channel serialization configuration can be set to support legacy Collection to ActionScript Array conversion.
(d) - Channel serialization configuration can be set to support legacy Map to ActionScript Array (associative) conversion.
(e) - Objects are serialized using Java Bean introspection rules. Fields that are static, transient or non-public are excluded.

Specified by:
writeObject in interface ActionMessageOutput
Specified by:
writeObject in interface ObjectOutput
Parameters:
o - the Object to be written
Throws:
IOException - if an I/O error occurs

writeObjectTraits

public void writeObjectTraits(TraitsInfo ti)
                       throws IOException
Throws:
IOException

writeObjectProperty

public void writeObjectProperty(String name,
                                Object value)
                         throws IOException
Throws:
IOException

writeObjectEnd

public void writeObjectEnd()
                    throws IOException
Throws:
IOException

writeUTF

public void writeUTF(String s)
              throws IOException
Description copied from class: AbstractAmfOutput

Specified by:
writeUTF in interface DataOutput
Overrides:
writeUTF in class AbstractAmfOutput
Throws:
IOException

setDebugTrace

public void setDebugTrace(AmfTrace trace)
Turns on "trace" debugging for AMF responses.

Parameters:
trace - the trace object


Copyright © 2008 Adobe Systems Inc. All Rights Reserved.

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/blazeds/1/javadoc/flex/messaging/io/amfx/AmfxOutput.html