Package com.wowza.wms.amf
Class AMFDataObj
- Object
- 
- com.wowza.wms.amf.AMFData
- 
- com.wowza.wms.amf.AMFDataObj
 
 
- 
- All Implemented Interfaces:
- IAMFDataObj
 - Direct Known Subclasses:
- AMFDataMixedArray
 
 public class AMFDataObj extends AMFData implements IAMFDataObj AMFDataObj: class for marshalling data between Wowza Pro server and Flash client. Object with attributes. Implementation is very similar to a java.util.Map. Each parameter is an item in the map. Create AMFDataObjAMFDataObj amfDataObj = new AMFDataObj(); amfDataObj.put("key1", "item1"); amfDataObj.put("key2", "item2"); amfDataObj.put("key3", "item3");Iterate AMFDataObjAMFDataObj amfDataObj; List keys = amfDataObj.getKeys(); Iterator iter = keys.iterator(); while(iter.hasNext()) { String key = (String)iter.next(); AMFData value = amfDataObj.get(key); int itemType = value.getType(); WMSLoggerFactory.getLogger(null).debug(key+"="+value.toString()+" (type:"+itemType+")"); }Direct Access To AttributesAMFDataObj amfDataObj; // If you know the type you can access it directly String dataString = amfDataObj.getString("stringData"); long dataLong = amfDataObj.getLong("longData"); double dataDouble = amfDataObj.getDouble("doubleData"); boolean dataBoolean = amfDataObj.getBoolean("booleanData"); // This illustrate how to decode the value if // you don't know the type AMFData myItemKey1 = amfDataObj.get("theData"); switch (myItemKey1.getType()) { default: case AMFDataItem.DATA_TYPE_UNDEFINED: case AMFDataItem.DATA_TYPE_UNKNOWN: case AMFDataItem.DATA_TYPE_NULL: // the value is null or undefined break; case AMFDataItem.DATA_TYPE_NUMBER: double amfDataDouble = ((AMFDataItem)myItemKey1).doubleValue(); break; case AMFDataItem.DATA_TYPE_BOOLEAN: boolean amfDataBoolean = ((AMFDataItem)myItemKey1).booleanValue(); break; case AMFDataItem.DATA_TYPE_STRING: String amfDataString = ((AMFDataItem)myItemKey1).toString(); break; case AMFDataItem.DATA_TYPE_DATE: Date amfDataDate = ((AMFDataItem)myItemKey1).dateValue(); break; case AMFDataItem.DATA_TYPE_OBJECT: AMFDataObj amfDataValObj = (AMFDataObj)myItemKey1; break; case AMFDataItem.DATA_TYPE_MIXED_ARRAY: AMFDataMixedArray amfDataMixedArray = (AMFDataMixedArray)myItemKey1; break; case AMFDataItem.DATA_TYPE_ARRAY: AMFDataArray amfDataArray = (AMFDataArray)myItemKey1; break; }
- 
- 
Field SummaryFields Modifier and Type Field Description static intDECODE_OBJ_REFstatic intDECODE_TRAITSstatic intDECODE_TRAITS_EXTstatic intDECODE_TRAITS_REFstatic intDECODE_UNDEFINEDprotected java.util.Map<String,AMFData>membersprotected java.util.List<String>orderprotected IAMFExternalizableserializerprotected AMFDataTraittrait- 
Fields inherited from class com.wowza.wms.amf.AMFDataAMF_DEFAULT_DESERIALIZE_CHARSETNAME, AMF_LEVEL0, AMF_LEVEL3, DATA_TYPE_AMF3, DATA_TYPE_AMF3_ARRAY, DATA_TYPE_AMF3_BOOLEAN_FALSE, DATA_TYPE_AMF3_BOOLEAN_TRUE, DATA_TYPE_AMF3_BYTEARRAY, DATA_TYPE_AMF3_DATE, DATA_TYPE_AMF3_INTEGER, DATA_TYPE_AMF3_NULL, DATA_TYPE_AMF3_NUMBER, DATA_TYPE_AMF3_OBJECT, DATA_TYPE_AMF3_STRING, DATA_TYPE_AMF3_UNDEFINED, DATA_TYPE_AMF3_XML_LEGACY, DATA_TYPE_AMF3_XML_TOP, DATA_TYPE_ARRAY, DATA_TYPE_AS_OBJECT, DATA_TYPE_BOOLEAN, DATA_TYPE_BYTEARRAY, DATA_TYPE_CUSTOM_CLASS, DATA_TYPE_DATE, DATA_TYPE_INTEGER, DATA_TYPE_LONG_STRING, DATA_TYPE_MIXED_ARRAY, DATA_TYPE_MOVIE_CLIP, DATA_TYPE_NULL, DATA_TYPE_NUMBER, DATA_TYPE_OBJECT, DATA_TYPE_OBJECT_END, DATA_TYPE_RECORDSET, DATA_TYPE_REFERENCE_OBJECT, DATA_TYPE_STRING, DATA_TYPE_UNDEFINED, DATA_TYPE_UNKNOWN, DATA_TYPE_XML, DATA_TYPE_XML_TOP, MILLS_PER_HOUR, type
 
- 
 - 
Constructor SummaryConstructors Constructor Description AMFDataObj()Create empty AMFDataObj objectAMFDataObj(byte[] data)Deserialize entire data array and create AMFDataObj objectAMFDataObj(byte[] data, int offset, int size)Deserialize data array starting at offest for size bytes and create AMFDataObj objectAMFDataObj(java.nio.ByteBuffer data)Deserialize entire data array and create AMFDataObj objectAMFDataObj(java.nio.ByteBuffer data, AMFDataContextDeserialize context)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsKey(String name)Return true if the object/array contains keyvoiddeserialize(java.nio.ByteBuffer data)Deserialize data in byte buffervoiddeserialize(java.nio.ByteBuffer data, AMFDataContextDeserialize context)Deserialize data in byte bufferAMFDataget(int index)Return the object at a particular index.AMFDataget(String name)Return the object at a particular key.booleangetBoolean(int index)Get item at index return as booleanbooleangetBoolean(String name)Get item at key return as booleanbytegetByte(int index)Get item at index return as bytebytegetByte(String name)Get item at key return as byteStringgetClassName()java.util.DategetDate(int index)Get item at index return as Datejava.util.DategetDate(String name)Get item at key return as DatedoublegetDouble(int index)Get item at index return as doubledoublegetDouble(String name)Get item at key return as doublefloatgetFloat(int index)Get item at index return as floatfloatgetFloat(String name)Get item at key return as floatintgetInt(int index)Get item at index return as intintgetInt(String name)Get item at key return as intStringgetKey(int index)Return the key at a particular index.java.util.ListgetKeys()Return a list of all the keys (the list is a copy)longgetLong(int index)Get item at index return as longlonggetLong(String name)Get item at key return as longAMFDataObjgetObject(int index)Get item at index return as AMFDataObjAMFDataObjgetObject(String name)Get item at key return as AMFDataObjIAMFExternalizablegetSerializer()shortgetShort(int index)Get item at index return as shortshortgetShort(String name)Get item at key return as shortStringgetString(int index)Get item at index return as StringStringgetString(String name)Get item at key return as StringAMFDataTraitgetTrait()ObjectgetValue()Convert object to Java native classvoidput(String name, boolean data)Put or replace boolean value at key (data will be wrapped in an AMFDataItem object)voidput(String name, double data)Put or replace double value at key (data will be wrapped in an AMFDataItem object)voidput(String name, int data)Put or replace int value at key (data will be wrapped in an AMFDataItem object)voidput(String name, long data)Put or replace long value at key (data will be wrapped in an AMFDataItem object)voidput(String name, AMFData data)Put or replace object at keyvoidput(String name, String data)Put or replace string value at key (data will be wrapped in an AMFDataItem object)voidput(String name, java.util.Date data)Put or replace date value at key (data will be wrapped in an AMFDataItem object)AMFDataremove(int index)Remove element by indexAMFDataremove(String name)Remove element by keybyte[]serialize()Serial object to byte arraybyte[]serialize(int objectEncoding)Serial object to byte arraybyte[]serialize(AMFDataContextSerialize context)Serial object to byte arrayvoidserialize(java.io.DataOutputStream out)Serialize object to output streamvoidserialize(java.io.DataOutputStream out, int objectEncoding)Serialize object to output streamvoidserialize(java.io.DataOutputStream out, AMFDataContextSerialize context)Serialize object to output streamvoidsetClassName(String className)voidsetSerializer(IAMFExternalizable serializer)intsize()Return the number of members of this object/arrayStringtoString()Return object as formatted string- 
Methods inherited from class com.wowza.wms.amf.AMFDatacreateContextDeserialize, createContextDeserialize, createContextSerialize, createContextSerialize, deserializeInnerObject, getReference, getType, isAMF3Start, isArrayStart, isByteArrayStart, isMixedArrayStart, isObjEnd, isObjStart, peekByte, setType, skipByte, testNextByte, triggerAMF3Switch
 
- 
 
- 
- 
- 
Field Detail- 
DECODE_UNDEFINEDpublic static final int DECODE_UNDEFINED - See Also:
- Constant Field Values
 
 - 
DECODE_OBJ_REFpublic static final int DECODE_OBJ_REF - See Also:
- Constant Field Values
 
 - 
DECODE_TRAITS_REFpublic static final int DECODE_TRAITS_REF - See Also:
- Constant Field Values
 
 - 
DECODE_TRAITS_EXTpublic static final int DECODE_TRAITS_EXT - See Also:
- Constant Field Values
 
 - 
DECODE_TRAITSpublic static final int DECODE_TRAITS - See Also:
- Constant Field Values
 
 - 
membersprotected java.util.Map<String,AMFData> members 
 - 
orderprotected java.util.List<String> order 
 - 
traitprotected AMFDataTrait trait 
 - 
serializerprotected IAMFExternalizable serializer 
 
- 
 - 
Constructor Detail- 
AMFDataObjpublic AMFDataObj() Create empty AMFDataObj object
 - 
AMFDataObjpublic AMFDataObj(byte[] data) Deserialize entire data array and create AMFDataObj object- Parameters:
- data- binary data
 
 - 
AMFDataObjpublic AMFDataObj(byte[] data, int offset, int size)Deserialize data array starting at offest for size bytes and create AMFDataObj object- Parameters:
- data- binary data
- offset- starting offset into data
- size- size of data to deserialize
 
 - 
AMFDataObjpublic AMFDataObj(java.nio.ByteBuffer data) Deserialize entire data array and create AMFDataObj object- Parameters:
- data- binary data
 
 - 
AMFDataObjpublic AMFDataObj(java.nio.ByteBuffer data, AMFDataContextDeserialize context)
 
- 
 - 
Method Detail- 
sizepublic int size() Return the number of members of this object/array- Returns:
- number of members
 
 - 
containsKeypublic boolean containsKey(String name) Description copied from interface:IAMFDataObjReturn true if the object/array contains key- Specified by:
- containsKeyin interface- IAMFDataObj
- Parameters:
- name- key
- Returns:
- Return true the object/array contains key
 
 - 
putpublic void put(String name, AMFData data)Description copied from interface:IAMFDataObjPut or replace object at key- Specified by:
- putin interface- IAMFDataObj
- Parameters:
- name- key
- data- object
 
 - 
putpublic void put(String name, String data)Description copied from interface:IAMFDataObjPut or replace string value at key (data will be wrapped in an AMFDataItem object)- Specified by:
- putin interface- IAMFDataObj
- Parameters:
- name- key
- data- string value
 
 - 
putpublic void put(String name, double data)Description copied from interface:IAMFDataObjPut or replace double value at key (data will be wrapped in an AMFDataItem object)- Specified by:
- putin interface- IAMFDataObj
- Parameters:
- name- key
- data- double value
 
 - 
putpublic void put(String name, int data)Description copied from interface:IAMFDataObjPut or replace int value at key (data will be wrapped in an AMFDataItem object)- Specified by:
- putin interface- IAMFDataObj
- Parameters:
- name- key
- data- int value
 
 - 
putpublic void put(String name, long data)Description copied from interface:IAMFDataObjPut or replace long value at key (data will be wrapped in an AMFDataItem object)- Specified by:
- putin interface- IAMFDataObj
- Parameters:
- name- key
- data- long value
 
 - 
putpublic void put(String name, java.util.Date data)Description copied from interface:IAMFDataObjPut or replace date value at key (data will be wrapped in an AMFDataItem object)- Specified by:
- putin interface- IAMFDataObj
- Parameters:
- name- key
- data- date value
 
 - 
putpublic void put(String name, boolean data)Description copied from interface:IAMFDataObjPut or replace boolean value at key (data will be wrapped in an AMFDataItem object)- Specified by:
- putin interface- IAMFDataObj
- Parameters:
- name- key
- data- boolean value
 
 - 
getKeyspublic java.util.List getKeys() Description copied from interface:IAMFDataObjReturn a list of all the keys (the list is a copy)- Specified by:
- getKeysin interface- IAMFDataObj
- Returns:
- new list that contains one entry for each key
 
 - 
getKeypublic String getKey(int index) Description copied from interface:IAMFDataObjReturn the key at a particular index.- Specified by:
- getKeyin interface- IAMFDataObj
- Returns:
- Return key at index or null if out of bounds
 
 - 
getpublic AMFData get(String name) Description copied from interface:IAMFDataObjReturn the object at a particular key.- Specified by:
- getin interface- IAMFDataObj
- Parameters:
- name- key
- Returns:
- Return object or null if out of bounds
 
 - 
getpublic AMFData get(int index) Description copied from interface:IAMFDataObjReturn the object at a particular index.- Specified by:
- getin interface- IAMFDataObj
- Parameters:
- index- index
- Returns:
- Return object or null if out of bounds
 
 - 
removepublic AMFData remove(String name) Description copied from interface:IAMFDataObjRemove element by key- Specified by:
- removein interface- IAMFDataObj
- Parameters:
- name- key
- Returns:
- removed object or null if not found
 
 - 
removepublic AMFData remove(int index) Description copied from interface:IAMFDataObjRemove element by index- Specified by:
- removein interface- IAMFDataObj
- Parameters:
- index- index
- Returns:
- removed object or null if not found
 
 - 
getStringpublic String getString(String name) Description copied from interface:IAMFDataObjGet item at key return as String- Specified by:
- getStringin interface- IAMFDataObj
- Parameters:
- name- key
- Returns:
- Return item as String or null if out of bounds
 
 - 
getIntpublic int getInt(String name) Description copied from interface:IAMFDataObjGet item at key return as int- Specified by:
- getIntin interface- IAMFDataObj
- Parameters:
- name- key
- Returns:
- Return item as int or 0 if out of bounds
 
 - 
getLongpublic long getLong(String name) Description copied from interface:IAMFDataObjGet item at key return as long- Specified by:
- getLongin interface- IAMFDataObj
- Parameters:
- name- key
- Returns:
- Return item as long or 0 if out of bounds
 
 - 
getShortpublic short getShort(String name) Description copied from interface:IAMFDataObjGet item at key return as short- Specified by:
- getShortin interface- IAMFDataObj
- Parameters:
- name- key
- Returns:
- Return item as short or 0 if out of bounds
 
 - 
getDoublepublic double getDouble(String name) Description copied from interface:IAMFDataObjGet item at key return as double- Specified by:
- getDoublein interface- IAMFDataObj
- Parameters:
- name- key
- Returns:
- Return item as double or 0 if out of bounds
 
 - 
getFloatpublic float getFloat(String name) Description copied from interface:IAMFDataObjGet item at key return as float- Specified by:
- getFloatin interface- IAMFDataObj
- Parameters:
- name- key
- Returns:
- Return item as float or 0 if out of bounds
 
 - 
getBytepublic byte getByte(String name) Description copied from interface:IAMFDataObjGet item at key return as byte- Specified by:
- getBytein interface- IAMFDataObj
- Parameters:
- name- key
- Returns:
- Return item as byte or 0 if out of bounds
 
 - 
getBooleanpublic boolean getBoolean(String name) Description copied from interface:IAMFDataObjGet item at key return as boolean- Specified by:
- getBooleanin interface- IAMFDataObj
- Parameters:
- name- key
- Returns:
- Return item as boolean or false if out of bounds
 
 - 
getDatepublic java.util.Date getDate(String name) Description copied from interface:IAMFDataObjGet item at key return as Date- Specified by:
- getDatein interface- IAMFDataObj
- Parameters:
- name- key
- Returns:
- Return item as Date or null if out of bounds
 
 - 
getObjectpublic AMFDataObj getObject(String name) Description copied from interface:IAMFDataObjGet item at key return as AMFDataObj- Specified by:
- getObjectin interface- IAMFDataObj
- Parameters:
- name- key
- Returns:
- Return item as AMFDataObj or null if out of bounds
 
 - 
getStringpublic String getString(int index) Description copied from interface:IAMFDataObjGet item at index return as String- Specified by:
- getStringin interface- IAMFDataObj
- Parameters:
- index- index
- Returns:
- Return item as String or null if out of bounds
 
 - 
getIntpublic int getInt(int index) Description copied from interface:IAMFDataObjGet item at index return as int- Specified by:
- getIntin interface- IAMFDataObj
- Parameters:
- index- index
- Returns:
- Return item as int or 0 if out of bounds
 
 - 
getLongpublic long getLong(int index) Description copied from interface:IAMFDataObjGet item at index return as long- Specified by:
- getLongin interface- IAMFDataObj
- Parameters:
- index- index
- Returns:
- Return item as long or 0 if out of bounds
 
 - 
getShortpublic short getShort(int index) Description copied from interface:IAMFDataObjGet item at index return as short- Specified by:
- getShortin interface- IAMFDataObj
- Parameters:
- index- index
- Returns:
- Return item as short or 0 if out of bounds
 
 - 
getBytepublic byte getByte(int index) Description copied from interface:IAMFDataObjGet item at index return as byte- Specified by:
- getBytein interface- IAMFDataObj
- Parameters:
- index- index
- Returns:
- Return item as byte or 0 if out of bounds
 
 - 
getDoublepublic double getDouble(int index) Description copied from interface:IAMFDataObjGet item at index return as double- Specified by:
- getDoublein interface- IAMFDataObj
- Parameters:
- index- index
- Returns:
- Return item as double or 0 if out of bounds
 
 - 
getFloatpublic float getFloat(int index) Description copied from interface:IAMFDataObjGet item at index return as float- Specified by:
- getFloatin interface- IAMFDataObj
- Parameters:
- index- index
- Returns:
- Return item as float or 0 if out of bounds
 
 - 
getBooleanpublic boolean getBoolean(int index) Description copied from interface:IAMFDataObjGet item at index return as boolean- Specified by:
- getBooleanin interface- IAMFDataObj
- Parameters:
- index- index
- Returns:
- Return item as boolean or false if out of bounds
 
 - 
getDatepublic java.util.Date getDate(int index) Description copied from interface:IAMFDataObjGet item at index return as Date- Specified by:
- getDatein interface- IAMFDataObj
- Parameters:
- index- index
- Returns:
- Return item as Date or null if out of bounds
 
 - 
getObjectpublic AMFDataObj getObject(int index) Description copied from interface:IAMFDataObjGet item at index return as AMFDataObj- Specified by:
- getObjectin interface- IAMFDataObj
- Parameters:
- index- index
- Returns:
- Return item as AMFDataObj or null if out of bounds
 
 - 
deserializepublic void deserialize(java.nio.ByteBuffer data) Description copied from class:AMFDataDeserialize data in byte buffer- Specified by:
- deserializein class- AMFData
- Parameters:
- data- binary data
 
 - 
deserializepublic void deserialize(java.nio.ByteBuffer data, AMFDataContextDeserialize context)Description copied from class:AMFDataDeserialize data in byte buffer- Specified by:
- deserializein class- AMFData
- Parameters:
- data- binary data
- context- deserialization context used by AMF3
 
 - 
serializepublic void serialize(java.io.DataOutputStream out) Description copied from class:AMFDataSerialize object to output stream
 - 
serializepublic void serialize(java.io.DataOutputStream out, int objectEncoding)Description copied from class:AMFDataSerialize object to output stream
 - 
serializepublic void serialize(java.io.DataOutputStream out, AMFDataContextSerialize context)Description copied from class:AMFDataSerialize object to output stream
 - 
serializepublic byte[] serialize() Description copied from class:AMFDataSerial object to byte array
 - 
serializepublic byte[] serialize(int objectEncoding) Description copied from class:AMFDataSerial object to byte array
 - 
serializepublic byte[] serialize(AMFDataContextSerialize context) Description copied from class:AMFDataSerial object to byte array
 - 
getValuepublic Object getValue() Description copied from class:AMFDataConvert object to Java native class
 - 
toStringpublic String toString() Return object as formatted string- Overrides:
- toStringin class- Object
 
 - 
getClassNamepublic String getClassName() 
 - 
setClassNamepublic void setClassName(String className) 
 - 
getTraitpublic AMFDataTrait getTrait() 
 - 
getSerializerpublic IAMFExternalizable getSerializer() 
 - 
setSerializerpublic void setSerializer(IAMFExternalizable serializer) 
 
- 
 
-