Package com.wowza.wms.amf
Class AMFDataItem
- Object
-
- com.wowza.wms.amf.AMFData
-
- com.wowza.wms.amf.AMFDataItem
-
public class AMFDataItem extends AMFData
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
Fields Modifier and Type Field Description static String
DATEFORMAT
protected org.apache.commons.lang.time.FastDateFormat
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
Constructors Constructor Description AMFDataItem()
Construct 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(java.nio.ByteBuffer data)
Deserialize entire data array and create AMFDataItem objectAMFDataItem(java.nio.ByteBuffer data, AMFDataContextDeserialize context)
AMFDataItem(java.util.Date value)
Construct AMF type DATA_TYPE_DATE
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
booleanValue()
Return object as boolean.byte
byteValue()
Return object as byte.java.util.Date
dateValue()
Return object as Date.void
deserialize(java.nio.ByteBuffer data)
Deserialize data in byte buffervoid
deserialize(java.nio.ByteBuffer data, AMFDataContextDeserialize context)
Deserialize data in byte bufferdouble
doubleValue()
Return object as double.float
floatValue()
Return object as float.Object
getValue()
Return value as Java classint
intValue()
Return object as int.long
longValue()
Return object as long.byte[]
serialize()
Serial object to byte arraybyte[]
serialize(int objectEncoding)
Serial object to byte arraybyte[]
serialize(AMFDataContextSerialize context)
Serial object to byte arrayvoid
serialize(java.io.DataOutputStream out)
Serialize object to output streamvoid
serialize(java.io.DataOutputStream out, int objectEncoding)
Serialize object to output streamvoid
serialize(java.io.DataOutputStream out, AMFDataContextSerialize context)
Serialize object to output streamshort
shortValue()
Return object as short.String
toString()
Return object as formatted string-
Methods 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 Detail
-
DATEFORMAT
public static final String DATEFORMAT
- See Also:
- Constant Field Values
-
fastDateFormat
protected org.apache.commons.lang.time.FastDateFormat fastDateFormat
-
-
Constructor Detail
-
AMFDataItem
public AMFDataItem()
Construct AMF type DATA_TYPE_NULL object
-
AMFDataItem
public AMFDataItem(String value)
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
public AMFDataItem(java.util.Date value)
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
public AMFDataItem(java.nio.ByteBuffer data)
Deserialize entire data array and create AMFDataItem object- Parameters:
data
- binary data
-
AMFDataItem
public AMFDataItem(java.nio.ByteBuffer data, AMFDataContextDeserialize context)
-
-
Method Detail
-
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
public java.util.Date 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
public void deserialize(java.nio.ByteBuffer data)
Description copied from class:AMFData
Deserialize data in byte buffer- Specified by:
deserialize
in classAMFData
- Parameters:
data
- binary data
-
deserialize
public void deserialize(java.nio.ByteBuffer data, AMFDataContextDeserialize context)
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
public Object getValue()
Return value as Java class
-
toString
public String toString()
Return object as formatted string- Overrides:
toString
in classObject
-
serialize
public void serialize(java.io.DataOutputStream out)
Description copied from class:AMFData
Serialize object to output stream
-
serialize
public void serialize(java.io.DataOutputStream out, int objectEncoding)
Description copied from class:AMFData
Serialize object to output stream
-
serialize
public void serialize(java.io.DataOutputStream out, AMFDataContextSerialize context)
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
public byte[] serialize(AMFDataContextSerialize context)
Description copied from class:AMFData
Serial object to byte array
-
-