org.openamf.io
Class AMFSerializer

java.lang.Object
  extended byorg.openamf.io.AMFSerializer

public class AMFSerializer
extends java.lang.Object

AMF Serializer

Version:
$Revision: 1.54 $, $Date: 2006/03/25 23:41:41 $
Author:
Jason Calabrese , Pat Maddox , Sylwester Lachiewicz , Richard Pitt

Field Summary
protected  java.io.DataOutputStream outputStream
          The output stream
 
Constructor Summary
AMFSerializer(java.io.DataOutputStream outputStream)
          Constructor
 
Method Summary
protected  java.lang.Object[] convertPrimitiveArrayToObjectArray(java.lang.Object array)
           
protected  boolean isPrimitiveArray(java.lang.Object obj)
           
 void serializeMessage(AMFMessage message)
          Writes message
protected  void write(java.util.Collection collection)
          Writes collection
protected  void write(org.w3c.dom.Document document)
          Writes XML Document
protected  void write(java.util.Iterator iterator)
          Writes Iterator - convert to List and call writeCollection
protected  void writeArray(java.lang.Object[] array)
          Writes Array Object - call writeData foreach element
protected  void writeBody(AMFBody body)
          Writes message body
protected  void writeData(java.lang.Object value)
          Writes Data
protected  void writeHeader(AMFHeader header)
          Writes message header
protected  void writeMap(java.util.Map map)
          Writes Object Map
protected  void writeObject(java.lang.Object object)
          Writes Object
protected  void writePrimitiveArray(java.lang.Object array)
           
protected  int writeString(java.lang.String str)
          Most of this code was cribbed from Java's DataOutputStream.writeUTF method which only supports Strings <= 65535 UTF-encoded characters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outputStream

protected java.io.DataOutputStream outputStream
The output stream

Constructor Detail

AMFSerializer

public AMFSerializer(java.io.DataOutputStream outputStream)
Constructor

Parameters:
outputStream -
Method Detail

serializeMessage

public void serializeMessage(AMFMessage message)
                      throws java.io.IOException
Writes message

Parameters:
message -
Throws:
java.io.IOException

writeHeader

protected void writeHeader(AMFHeader header)
                    throws java.io.IOException
Writes message header

Parameters:
header - AMF message header
Throws:
java.io.IOException

writeBody

protected void writeBody(AMFBody body)
                  throws java.io.IOException
Writes message body

Parameters:
body - AMF message body
Throws:
java.io.IOException

writeData

protected void writeData(java.lang.Object value)
                  throws java.io.IOException
Writes Data

Parameters:
value -
Throws:
java.io.IOException

writeObject

protected void writeObject(java.lang.Object object)
                    throws java.io.IOException
Writes Object

Parameters:
object -
Throws:
java.io.IOException

writeArray

protected void writeArray(java.lang.Object[] array)
                   throws java.io.IOException
Writes Array Object - call writeData foreach element

Parameters:
array -
Throws:
java.io.IOException

writePrimitiveArray

protected void writePrimitiveArray(java.lang.Object array)
                            throws java.io.IOException
Throws:
java.io.IOException

convertPrimitiveArrayToObjectArray

protected java.lang.Object[] convertPrimitiveArrayToObjectArray(java.lang.Object array)
                                                         throws java.io.IOException
Throws:
java.io.IOException

write

protected void write(java.util.Iterator iterator)
              throws java.io.IOException
Writes Iterator - convert to List and call writeCollection

Parameters:
iterator - Iterator
Throws:
java.io.IOException

write

protected void write(java.util.Collection collection)
              throws java.io.IOException
Writes collection

Parameters:
collection - Collection
Throws:
java.io.IOException

writeMap

protected void writeMap(java.util.Map map)
                 throws java.io.IOException
Writes Object Map

Parameters:
map -
Throws:
java.io.IOException

write

protected void write(org.w3c.dom.Document document)
              throws java.io.IOException
Writes XML Document

Parameters:
document -
Throws:
java.io.IOException

writeString

protected int writeString(java.lang.String str)
                   throws java.io.IOException
Most of this code was cribbed from Java's DataOutputStream.writeUTF method which only supports Strings <= 65535 UTF-encoded characters.

Throws:
java.io.IOException

isPrimitiveArray

protected boolean isPrimitiveArray(java.lang.Object obj)