Package com.wowza.wms.amf
Class AMFDataItem
Object
com.wowza.wms.amf.AMFData
com.wowza.wms.amf.AMFDataItem
AMFDataItem: class for marshalling data between Wowza Pro server and Flash client. The type wraps native Java data types.
- DATA_TYPE_NUMBER = int, long, short, double, float
- DATA_TYPE_STRING = String
- DATA_TYPE_BOOLEAN = boolean
- DATA_TYPE_DATE = Date
- DATA_TYPE_NULL = 'null'
Create Native Java Types
AMFDataItem amfDataString = new AMFDataItem("here is my string"); // String
AMFDataItem amfDataLong = new AMFDataItem(1234L); // long
AMFDataItem amfDataDouble = new AMFDataItem(1.234); // double
AMFDataItem amfDataBoolean = new AMFDataItem(true); // boolean
AMFDataItem amfDataNull = new AMFDataItem(); // null
Get Native Java Types
String dataString = amfDataString.getType()==AMFData.DATA_TYPE_LONG_STRING?
amfDataString.toString():"";
long dataLong = amfDataLong.getType()==AMFData.DATA_TYPE_NUMBER?
amfDataLong.longValue():0;
double dataDouble = amfDataDouble.getType()==AMFData.DATA_TYPE_NUMBER?
amfDataLong.doubleValue():0.0;
boolean dataBoolean = amfDataBoolean.getType()==AMFData.DATA_TYPE_BOOLEAN?
amfDataLong.booleanValue():false;
Object dataNull = amfDataNull.getType()==AMFData.DATA_TYPE_NULL?
null:null;
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
protected org.apache.commons.lang3.time.FastDateFormat
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
ConstructorsConstructorDescriptionConstruct AMF type DATA_TYPE_NULL objectAMFDataItem
(boolean value) Construct AMF type DATA_TYPE_BOOLEANAMFDataItem
(byte[] data) Deserialize entire data array and create AMFDataItem objectAMFDataItem
(byte[] data, int offset, int size) Deserialize data array starting at offest for size bytes and create AMFDataItem objectAMFDataItem
(double value) Construct AMF type DATA_TYPE_NUMBER objectAMFDataItem
(int value) Construct AMF type DATA_TYPE_NUMBER objectAMFDataItem
(long value) Construct AMF type DATA_TYPE_NUMBER objectAMFDataItem
(String value) Construct AMF type DATA_TYPE_STRING objectAMFDataItem
(ByteBuffer data) Deserialize entire data array and create AMFDataItem objectAMFDataItem
(ByteBuffer data, AMFDataContextDeserialize context) AMFDataItem
(Date value) Construct AMF type DATA_TYPE_DATE -
Method Summary
Modifier and TypeMethodDescriptionboolean
Return object as boolean.byte
Return object as byte.Return object as Date.void
deserialize
(ByteBuffer data) Deserialize data in byte buffervoid
deserialize
(ByteBuffer data, AMFDataContextDeserialize context) Deserialize data in byte bufferdouble
Return object as double.float
Return object as float.getValue()
Return value as Java classint
intValue()
Return object as int.long
Return object as long.byte[]
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 streamshort
Return object as short.toString()
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
-
Field Details
-
DATEFORMAT
- See Also:
-
fastDateFormat
protected org.apache.commons.lang3.time.FastDateFormat fastDateFormat
-
-
Constructor Details
-
AMFDataItem
public AMFDataItem()Construct AMF type DATA_TYPE_NULL object -
AMFDataItem
Construct AMF type DATA_TYPE_STRING object- Parameters:
value
- String value
-
AMFDataItem
public AMFDataItem(int value) Construct AMF type DATA_TYPE_NUMBER object- Parameters:
value
- int value
-
AMFDataItem
public AMFDataItem(long value) Construct AMF type DATA_TYPE_NUMBER object- Parameters:
value
- long value
-
AMFDataItem
public AMFDataItem(double value) Construct AMF type DATA_TYPE_NUMBER object- Parameters:
value
- double value
-
AMFDataItem
public AMFDataItem(boolean value) Construct AMF type DATA_TYPE_BOOLEAN- Parameters:
value
- boolean value
-
AMFDataItem
Construct AMF type DATA_TYPE_DATE- Parameters:
value
- Date value
-
AMFDataItem
public AMFDataItem(byte[] data) Deserialize entire data array and create AMFDataItem object- Parameters:
data
- binary data
-
AMFDataItem
public AMFDataItem(byte[] data, int offset, int size) Deserialize data array starting at offest for size bytes and create AMFDataItem object- Parameters:
data
- binary dataoffset
- starting offset into datasize
- size of data to deserialize
-
AMFDataItem
Deserialize entire data array and create AMFDataItem object- Parameters:
data
- binary data
-
AMFDataItem
-
-
Method Details
-
longValue
public long longValue()Return object as long. Valid object types are DATA_TYPE_NUMBER and DATA_TYPE_STRING.- Returns:
- long value or 0 if failure
-
intValue
public int intValue()Return object as int. Valid object types are DATA_TYPE_NUMBER and DATA_TYPE_STRING.- Returns:
- int value or 0 if failure
-
doubleValue
public double doubleValue()Return object as double. Valid object types are DATA_TYPE_NUMBER and DATA_TYPE_STRING.- Returns:
- double value or 0 if failure
-
floatValue
public float floatValue()Return object as float. Valid object types are DATA_TYPE_NUMBER and DATA_TYPE_STRING.- Returns:
- float value or 0 if failure
-
shortValue
public short shortValue()Return object as short. Valid object types are DATA_TYPE_NUMBER and DATA_TYPE_STRING.- Returns:
- short value or 0 if failure
-
byteValue
public byte byteValue()Return object as byte. Valid object types are DATA_TYPE_NUMBER and DATA_TYPE_STRING.- Returns:
- byte value or 0 if failure
-
dateValue
Return object as Date. Valid object types are DATA_TYPE_DATE.- Returns:
- Date value or null if failure
-
booleanValue
public boolean booleanValue()Return object as boolean. Valid object types are DATA_TYPE_BOOLEAN and DATA_TYPE_STRING.- Returns:
- boolean value or false if failure
-
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
-
getValue
Return value as Java class -
toString
Return object as formatted string -
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
-