|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.spicefactory.cinnamon.io.amf.AMFOutput
public class AMFOutput
The AMFOutput class serializes an AMFEnvelope instance containing one or more results from
service invocations to AMF data and writes it to a ByteBuffer.
This implementation only supports AMF3 data.
The only method that should be called by application code is writeEnvelope which does
all the serialization work. Other methods will be invoked by collaborating objects like
class mapping and externalizer instances.
| Field Summary | |
|---|---|
static int |
MAX_INT
|
static int |
MIN_INT
|
| Constructor Summary | |
|---|---|
AMFOutput(org.apache.mina.common.ByteBuffer buffer,
CinnamonConfig config)
Creates a new AMFOutput instance. |
|
| Method Summary | |
|---|---|
protected void |
addClassDescriptor(ClassMapping mapping)
Adds a class mapping to the list of references. |
protected void |
addObjectReference(Object value)
Adds an object to the list of references. |
protected void |
addStringReference(String str)
Adds a string to the list of references. |
protected Integer |
getClassDescriptorIndex(ClassMapping mapping)
Returns the index for the specified mapping if this mapping has already been serialized in the current AMF message. |
void |
reset()
Resets all internal Collections of object references. |
protected void |
writeAMFArray(Object value)
Writes an AMF3 Array value. |
protected void |
writeAMFByteArray(byte[] value)
Writes an AMF3 byte array. |
protected void |
writeAMFDate(Date value)
Writes an AMF3 Date value. |
protected void |
writeAMFInt(int value)
Writes an AMF3 int value including the type code byte. |
protected void |
writeAMFIntOrNumber(Number value)
Writes the specified Number value as an AMF int or AMF Number depending on the type of Number. |
void |
writeAMFIntValue(int value)
Writes an AMF3 int value without the type code byte. |
protected void |
writeAMFLengthAndString(String value)
Writes the specified String in UTF-8 encoding prepending by an int for the length of the String in bytes. |
protected void |
writeAMFNumber(double value)
Writes a double value as an AMF3 Number. |
protected void |
writeAMFObject(Object object)
Writes an AMF3 object. |
protected void |
writeAMFString(String value)
Writes an AMF3 String value in UTF-8 encoding including the type code byte. |
void |
writeAMFStringValue(String value)
Writes an AMF3 String value in UTF-8 encoding without the type code byte. |
protected void |
writeAMFXml(Object value)
Writes a DOM document instance. |
void |
writeBoolean(boolean value)
Writes a boolean value as a single byte. |
void |
writeByte(byte value)
Writes a single byte. |
void |
writeBytes(byte[] bytes,
int offset,
int length)
Writes the number of bytes specified by the length parameter from the given byte buffer starting at the specified offset. |
void |
writeDouble(double value)
Writes a double value. |
void |
writeFloat(float value)
Writes a float value. |
void |
writeInt(int value)
Writes an int value. |
void |
writeMultiByte(String value,
String charset)
Writes a multibyte string using the given character set. |
void |
writeObject(Object value)
Encodes and writes an object in AMF3 binary format. |
protected boolean |
writeObjectReference(Object value)
Writes an object reference to the ByteBuffer if the specified value was already encoded in this AMF message. |
void |
writeShort(short value)
Writes a short value. |
protected void |
writeString(String value,
Charset charset)
Writes a string value using the specified character set. |
protected boolean |
writeStringReference(String value)
Writes a String reference to the ByteBuffer if the specified value was already encoded in this AMF message. |
void |
writeUnsignedInt(long value)
Writes an unsigned int. |
void |
writeUTF(String value)
Writes a UTF-8 string prepended by a short value representing the length of the string in bytes. |
void |
writeUTFBytes(String value)
Writes a UTF-8 string. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int MAX_INT
public static final int MIN_INT
| Constructor Detail |
|---|
public AMFOutput(org.apache.mina.common.ByteBuffer buffer,
CinnamonConfig config)
buffer - the ByteBuffer to write AMF3 data intoconfig - the Cinnamon configuration instance| Method Detail |
|---|
public void writeObject(Object value)
DataOutput
writeObject in interface DataOutputvalue - the object to encode and writeprotected void writeAMFIntOrNumber(Number value)
value - the Number to be serializedprotected void writeAMFInt(int value)
value - the int value to serializepublic void writeAMFIntValue(int value)
value - the int value to serializeprotected void writeAMFNumber(double value)
value - the double value to serializeprotected void writeAMFString(String value)
value - the String value to be serializedpublic void writeAMFStringValue(String value)
value - the String value to be serializedprotected void writeAMFLengthAndString(String value)
value - the String value to be serializedprotected void writeAMFXml(Object value)
value - the DOM document instance to serializeprotected void writeAMFDate(Date value)
value - the Date to be serializedprotected void writeAMFArray(Object value)
value - the array or collection to be serializedprotected void writeAMFByteArray(byte[] value)
value - the byte array to be serializedprotected void writeAMFObject(Object object)
object - the object to be serializedpublic void reset()
protected void addStringReference(String str)
str - a string to add to the list of referencesprotected boolean writeStringReference(String value)
value - the string value a reference should be written for
protected void addObjectReference(Object value)
value - an object to add to the list of referencesprotected boolean writeObjectReference(Object value)
value - the object value a reference should be written for
protected void addClassDescriptor(ClassMapping mapping)
mapping - a mapping to add to the map of class descriptorsprotected Integer getClassDescriptorIndex(ClassMapping mapping)
mapping - the class mapping to return the reference index for
public void writeBoolean(boolean value)
DataOutput
writeBoolean in interface DataOutputvalue - the boolean value to writepublic void writeByte(byte value)
DataOutput
writeByte in interface DataOutputvalue - the byte value to write
public void writeBytes(byte[] bytes,
int offset,
int length)
DataOutput
writeBytes in interface DataOutputbytes - the data to writeoffset - the offset into the datalength - the number of bytes to writepublic void writeDouble(double value)
DataOutput
writeDouble in interface DataOutputvalue - the double value to writepublic void writeFloat(float value)
DataOutput
writeFloat in interface DataOutputvalue - the float value to writepublic void writeShort(short value)
DataOutput
writeShort in interface DataOutputvalue - the short value to writepublic void writeInt(int value)
DataOutput
writeInt in interface DataOutputvalue - the int value to writepublic void writeUnsignedInt(long value)
DataOutput
writeUnsignedInt in interface DataOutputpublic void writeUTF(String value)
DataOutput
writeUTF in interface DataOutputpublic void writeUTFBytes(String value)
DataOutput
writeUTFBytes in interface DataOutput
public void writeMultiByte(String value,
String charset)
DataOutput
writeMultiByte in interface DataOutputvalue - the string to writecharset - the character set to use to decode the bytes
protected void writeString(String value,
Charset charset)
value - the string value to be serializedcharset - the character set to use
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||