Package com.wowza.wms.amf
Class AMFDataArray
Object
com.wowza.wms.amf.AMFData
com.wowza.wms.amf.AMFDataArray
AMFDataArray: class for marshalling data between Wowza Pro server and Flash client. This class is a simple ordered array of items.
Create Array of Strings
AMFDataArray amfDataArray = new AMFDataArray();
amfDataArray.add("item1");
amfDataArray.add("item2");
amfDataArray.add("item3");
Iterate Items In Array
AMFDataArray amfDataArray;
for(int i=0;i<amfDataArray.size();i++)
{
AMFData amfData = amfDataArray.get(i);
WMSLoggerFactory.getLogger(null).debug("amfData.getType(): "+amfData.getType());
}
NOTE: There is a slight difference between this class and AMFDataList. This class when serialized/deserialized does include the DATA_TYPE_ARRAY header (byte) and array size (int).
NOTE: Simple arrays created in the Flash player client and sent to the Wowza Pro server are of type
AMFDataMixedArray
.
-
Field Summary
Fields inherited from class com.wowza.wms.amf.AMFData
AMF_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 Summary
ConstructorsConstructorDescriptionCreate empty AMFDataArray objectAMFDataArray
(byte[] data) Deserialize entire data array and create AMFDataArray objectAMFDataArray
(byte[] data, int offset, int size) Deserialize data array starting at offest for size bytes and create AMFDataArray objectAMFDataArray
(ByteBuffer data) Deserialize entire data array and create AMFDataArray objectAMFDataArray
(ByteBuffer data, AMFDataContextDeserialize context) -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(boolean data) Append a boolean (will be wrapped in an AMFDataItem object)void
add
(double data) Append a double (will be wrapped in an AMFDataItem object)void
add
(int data) Append a int (will be wrapped in an AMFDataItem object)void
add
(int index, boolean data) Insert a boolean value (will be wrapped in an AMFDataItem object)void
add
(int index, double data) Insert a double value (will be wrapped in an AMFDataItem object)void
add
(int index, int data) Insert a int value (will be wrapped in an AMFDataItem object)void
add
(int index, long data) Insert a long value (will be wrapped in an AMFDataItem object)void
Insert an item into the arrayvoid
Insert a string value (will be wrapped in an AMFDataItem object)void
Insert a date value (will be wrapped in an AMFDataItem object)void
add
(long data) Append a long (will be wrapped in an AMFDataItem object)void
Append a new item onto the arrayvoid
Append a string (will be wrapped in an AMFDataItem object)void
Append a date (will be wrapped in an AMFDataItem object)void
deserialize
(ByteBuffer data) Deserialize data in byte buffervoid
deserialize
(ByteBuffer data, AMFDataContextDeserialize context) Deserialize data in byte bufferget
(int index) Get item at indexboolean
getBoolean
(int index) Get item at index return as booleanbyte
getByte
(int index) Get item at index return as bytegetDate
(int index) Get item at index return as Datedouble
getDouble
(int index) Get item at index return as doublefloat
getFloat
(int index) Get item at index return as floatint
getInt
(int index) Get item at index return as intlong
getLong
(int index) Get item at index return as longgetObject
(int index) Get item at index return as AMFDataObjshort
getShort
(int index) Get item at index return as shortgetString
(int index) Get item at index return as StringgetValue()
Convert object to Java native classremove
(int index) Remove an item from the arraybyte[]
Serial object to byte arraybyte[]
serialize
(int objectEncoding) Serial object to byte arraybyte[]
serialize
(AMFDataContextSerialize context) Serial object to byte arrayvoid
Serialize object to output streamvoid
serialize
(DataOutputStream out, int objectEncoding) Serialize object to output streamvoid
serialize
(DataOutputStream out, AMFDataContextSerialize context) Serialize object to output streamvoid
set
(int index, boolean data) Set an boolean value (will be wrapped in an AMFDataItem object)void
set
(int index, double data) Set an double value (will be wrapped in an AMFDataItem object)void
set
(int index, int data) Set an int value (will be wrapped in an AMFDataItem object)void
set
(int index, long data) Set an long value (will be wrapped in an AMFDataItem object)void
Set an array itemvoid
Set an string value (will be wrapped in an AMFDataItem object)void
Set an date value (will be wrapped in an AMFDataItem object)int
size()
Returns the number of items in arraytoString()
Return object as formatted stringMethods inherited from class com.wowza.wms.amf.AMFData
createContextDeserialize, createContextDeserialize, createContextSerialize, createContextSerialize, deserializeInnerObject, getReference, getType, isAMF3Start, isArrayStart, isByteArrayStart, isMixedArrayStart, isObjEnd, isObjStart, peekByte, setType, skipByte, testNextByte, triggerAMF3Switch
-
Constructor Details
-
AMFDataArray
public AMFDataArray()Create empty AMFDataArray object -
AMFDataArray
public AMFDataArray(byte[] data) Deserialize entire data array and create AMFDataArray object- Parameters:
data
- binary data
-
AMFDataArray
public AMFDataArray(byte[] data, int offset, int size) Deserialize data array starting at offest for size bytes and create AMFDataArray object- Parameters:
data
- binary dataoffset
- starting offset into datasize
- size of data to deserialize
-
AMFDataArray
Deserialize entire data array and create AMFDataArray object- Parameters:
data
- binary data
-
AMFDataArray
-
-
Method Details
-
remove
Remove an item from the array- Parameters:
index
- index- Returns:
- delete item or null if not found
-
size
public int size()Returns the number of items in array- Returns:
- number of items in array
-
add
Append a new item onto the array- Parameters:
data
- AMFData object
-
add
Append a string (will be wrapped in an AMFDataItem object)- Parameters:
data
- string value
-
add
public void add(double data) Append a double (will be wrapped in an AMFDataItem object)- Parameters:
data
- double value
-
add
public void add(int data) Append a int (will be wrapped in an AMFDataItem object)- Parameters:
data
- int value
-
add
public void add(long data) Append a long (will be wrapped in an AMFDataItem object)- Parameters:
data
- long value
-
add
Append a date (will be wrapped in an AMFDataItem object)- Parameters:
data
- date value
-
add
public void add(boolean data) Append a boolean (will be wrapped in an AMFDataItem object)- Parameters:
data
- boolean value
-
add
Insert an item into the array- Parameters:
index
- indexdata
- AMFData object
-
add
Insert a string value (will be wrapped in an AMFDataItem object)- Parameters:
index
- indexdata
- string value
-
add
public void add(int index, double data) Insert a double value (will be wrapped in an AMFDataItem object)- Parameters:
index
- indexdata
- double value
-
add
public void add(int index, int data) Insert a int value (will be wrapped in an AMFDataItem object)- Parameters:
index
- indexdata
- int value
-
add
public void add(int index, long data) Insert a long value (will be wrapped in an AMFDataItem object)- Parameters:
index
- indexdata
- long value
-
add
Insert a date value (will be wrapped in an AMFDataItem object)- Parameters:
index
- indexdata
- date value
-
add
public void add(int index, boolean data) Insert a boolean value (will be wrapped in an AMFDataItem object)- Parameters:
index
- indexdata
- boolean value
-
set
Set an array item- Parameters:
index
- indexdata
- AMFData object
-
set
Set an string value (will be wrapped in an AMFDataItem object)- Parameters:
index
- indexdata
- string value
-
set
public void set(int index, double data) Set an double value (will be wrapped in an AMFDataItem object)- Parameters:
index
- indexdata
- double value
-
set
public void set(int index, int data) Set an int value (will be wrapped in an AMFDataItem object)- Parameters:
index
- indexdata
- int value
-
set
public void set(int index, long data) Set an long value (will be wrapped in an AMFDataItem object)- Parameters:
index
- indexdata
- long value
-
set
Set an date value (will be wrapped in an AMFDataItem object)- Parameters:
index
- indexdata
- date value
-
set
public void set(int index, boolean data) Set an boolean value (will be wrapped in an AMFDataItem object)- Parameters:
index
- indexdata
- boolean value
-
get
Get item at index- Parameters:
index
-- Returns:
- Returns AMFData object or null if out of bounds
-
getString
Get item at index return as String- Parameters:
index
-- Returns:
- Return item as String or null if out of bounds
-
getInt
public int getInt(int index) Get item at index return as int- Parameters:
index
-- Returns:
- Return item as int or 0 if out of bounds
-
getLong
public long getLong(int index) Get item at index return as long- Parameters:
index
-- Returns:
- Return item as long or 0 if out of bounds
-
getShort
public short getShort(int index) Get item at index return as short- Parameters:
index
-- Returns:
- Return item as short or 0 if out of bounds
-
getByte
public byte getByte(int index) Get item at index return as byte- Parameters:
index
-- Returns:
- Return item as byte or 0 if out of bounds
-
getBoolean
public boolean getBoolean(int index) Get item at index return as boolean- Parameters:
index
-- Returns:
- Return item as boolean or false if out of bounds
-
getDate
Get item at index return as Date- Parameters:
index
-- Returns:
- Return item as Date or null if out of bounds
-
getObject
Get item at index return as AMFDataObj- Parameters:
index
-- Returns:
- Return item as AMFDataObj or null if out of bounds
-
getDouble
public double getDouble(int index) Get item at index return as double- Parameters:
index
-- Returns:
- Return item as double or 0 if out of bounds
-
getFloat
public float getFloat(int index) Get item at index return as float- Parameters:
index
-- Returns:
- Return item as float or 0 if out of bounds
-
deserialize
Description copied from class:AMFData
Deserialize data in byte buffer- Specified by:
deserialize
in classAMFData
- Parameters:
data
- binary data
-
deserialize
Description copied from class:AMFData
Deserialize data in byte buffer- Specified by:
deserialize
in classAMFData
- Parameters:
data
- binary datacontext
- deserialization context used by AMF3
-
serialize
Description copied from class:AMFData
Serialize object to output stream -
serialize
Description copied from class:AMFData
Serialize object to output stream -
serialize
Description copied from class:AMFData
Serialize object to output stream -
serialize
public byte[] serialize()Description copied from class:AMFData
Serial object to byte array -
serialize
public byte[] serialize(int objectEncoding) Description copied from class:AMFData
Serial object to byte array -
serialize
Description copied from class:AMFData
Serial object to byte array -
getValue
Description copied from class:AMFData
Convert object to Java native class -
toString
Return object as formatted string
-