org.granite.messaging.amf.io
Class AMF0Serializer

java.lang.Object
  extended by org.granite.messaging.amf.io.AMF0Serializer

public class AMF0Serializer
extends Object

AMF Serializer

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

Constructor Summary
AMF0Serializer(OutputStream outputStream)
          Constructor
 
Method Summary
static String convertDOMToString(Node node)
           
protected  Object[] convertPrimitiveArrayToObjectArray(Object array)
           
protected  boolean isPrimitiveArray(Object obj)
           
 void serializeMessage(AMF0Message message)
          Writes message
protected  void write(Collection<?> collection)
          Writes collection
protected  void write(Document document)
          Writes XML Document
protected  void write(Iterator<?> iterator)
          Writes Iterator - convert to List and call writeCollection
protected  void writeArray(Object[] array)
          Writes Array Object - call writeData foreach element
protected  void writeBody(AMF0Body body)
          Writes message body
protected  void writeData(Object value)
          Writes Data
protected  void writeHeader(AMF0Header header)
          Writes message header
protected  void writeMap(Map<?,?> map)
          Writes Object Map
protected  void writeObject(Object object)
          Writes Object
protected  void writePrimitiveArray(Object array)
           
protected  int writeString(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
 

Constructor Detail

AMF0Serializer

public AMF0Serializer(OutputStream outputStream)
Constructor

Parameters:
outputStream -
Method Detail

serializeMessage

public void serializeMessage(AMF0Message message)
                      throws IOException
Writes message

Parameters:
message -
Throws:
IOException

writeHeader

protected void writeHeader(AMF0Header header)
                    throws IOException
Writes message header

Parameters:
header - AMF message header
Throws:
IOException

writeBody

protected void writeBody(AMF0Body body)
                  throws IOException
Writes message body

Parameters:
body - AMF message body
Throws:
IOException

writeData

protected void writeData(Object value)
                  throws IOException
Writes Data

Parameters:
value -
Throws:
IOException

writeObject

protected void writeObject(Object object)
                    throws IOException
Writes Object

Parameters:
object -
Throws:
IOException

writeArray

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

Parameters:
array -
Throws:
IOException

writePrimitiveArray

protected void writePrimitiveArray(Object array)
                            throws IOException
Throws:
IOException

convertPrimitiveArrayToObjectArray

protected Object[] convertPrimitiveArrayToObjectArray(Object array)

write

protected void write(Iterator<?> iterator)
              throws IOException
Writes Iterator - convert to List and call writeCollection

Parameters:
iterator - Iterator
Throws:
IOException

write

protected void write(Collection<?> collection)
              throws IOException
Writes collection

Parameters:
collection - Collection
Throws:
IOException

writeMap

protected void writeMap(Map<?,?> map)
                 throws IOException
Writes Object Map

Parameters:
map -
Throws:
IOException

write

protected void write(Document document)
              throws IOException
Writes XML Document

Parameters:
document -
Throws:
IOException

writeString

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

Throws:
IOException

isPrimitiveArray

protected boolean isPrimitiveArray(Object obj)

convertDOMToString

public static String convertDOMToString(Node node)