Package com.wowza.wms.amf
Class AMFData
- Object
-
- com.wowza.wms.amf.AMFData
-
- Direct Known Subclasses:
AMFDataArray
,AMFDataByteArray
,AMFDataItem
,AMFDataList
,AMFDataObj
public abstract class AMFData extends Object
Base abstract class for data in Action Message Format (AMF). Data is sent between the Flash client and the Wowza Streaming Engine using the AMF format. This class cannot be instantiated. It serves as the base class for all AMFData objects.
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description AMFData()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static AMFDataContextDeserialize
createContextDeserialize()
Create an AMF3 deserialization contextstatic AMFDataContextDeserialize
createContextDeserialize(int objectEncoding)
Create an AMF3 deserialization contextstatic AMFDataContextSerialize
createContextSerialize()
Create an AMF3 serialization contextstatic AMFDataContextSerialize
createContextSerialize(int objectEncoding)
Create an AMF3 serialization contextabstract void
deserialize(java.nio.ByteBuffer data)
Deserialize data in byte bufferabstract void
deserialize(java.nio.ByteBuffer data, AMFDataContextDeserialize context)
Deserialize data in byte bufferstatic AMFData
deserializeInnerObject(java.nio.ByteBuffer data, AMFDataContextDeserialize context)
Deserialize next itemstatic AMFData
getReference(java.nio.ByteBuffer data, AMFDataContextDeserialize context)
Get AMF3 object referenceint
getType()
Returns the data type for this objectabstract Object
getValue()
Convert object to Java native classstatic boolean
isAMF3Start(java.nio.ByteBuffer data, AMFDataContextDeserialize context)
Returns true if next byte in data is AMF3 startstatic boolean
isArrayStart(java.nio.ByteBuffer data, AMFDataContextDeserialize context)
Returns true if next byte in data is an array startstatic boolean
isByteArrayStart(java.nio.ByteBuffer data, AMFDataContextDeserialize context)
Returns true if next byte is ByteArray startstatic boolean
isMixedArrayStart(java.nio.ByteBuffer data, AMFDataContextDeserialize context)
Returns true if next byte in data is mixed array startstatic boolean
isObjEnd(java.nio.ByteBuffer data, AMFDataContextDeserialize context)
Returns true if next byte is object endstatic boolean
isObjStart(java.nio.ByteBuffer data, AMFDataContextDeserialize context)
Returns true if next byte in data is object startstatic int
peekByte(java.nio.ByteBuffer data)
Return the next byte in the buffer without incrementing the data positionabstract byte[]
serialize()
Serial object to byte arrayabstract byte[]
serialize(int objectEncoding)
Serial object to byte arrayabstract byte[]
serialize(AMFDataContextSerialize context)
Serial object to byte arrayabstract void
serialize(java.io.DataOutputStream out)
Serialize object to output streamabstract void
serialize(java.io.DataOutputStream out, int objectEncoding)
Serialize object to output streamabstract void
serialize(java.io.DataOutputStream out, AMFDataContextSerialize context)
Serialize object to output streamvoid
setType(int type)
Sets the the data type for this objectstatic int
skipByte(java.nio.ByteBuffer data)
Skip forward one byte in the byte bufferstatic boolean
testNextByte(java.nio.ByteBuffer data, int test)
Peek at the next value in data to see if its the test valuestatic boolean
triggerAMF3Switch(AMFData data)
Return true if the object is serialized differently in AMF3
-
-
-
Field Detail
-
DATA_TYPE_UNKNOWN
public static final byte DATA_TYPE_UNKNOWN
- See Also:
- Constant Field Values
-
DATA_TYPE_NUMBER
public static final byte DATA_TYPE_NUMBER
- See Also:
- Constant Field Values
-
DATA_TYPE_BOOLEAN
public static final byte DATA_TYPE_BOOLEAN
- See Also:
- Constant Field Values
-
DATA_TYPE_STRING
public static final byte DATA_TYPE_STRING
- See Also:
- Constant Field Values
-
DATA_TYPE_OBJECT
public static final byte DATA_TYPE_OBJECT
- See Also:
- Constant Field Values
-
DATA_TYPE_MOVIE_CLIP
public static final byte DATA_TYPE_MOVIE_CLIP
- See Also:
- Constant Field Values
-
DATA_TYPE_NULL
public static final byte DATA_TYPE_NULL
- See Also:
- Constant Field Values
-
DATA_TYPE_UNDEFINED
public static final byte DATA_TYPE_UNDEFINED
- See Also:
- Constant Field Values
-
DATA_TYPE_REFERENCE_OBJECT
public static final byte DATA_TYPE_REFERENCE_OBJECT
- See Also:
- Constant Field Values
-
DATA_TYPE_MIXED_ARRAY
public static final byte DATA_TYPE_MIXED_ARRAY
- See Also:
- Constant Field Values
-
DATA_TYPE_OBJECT_END
public static final byte DATA_TYPE_OBJECT_END
- See Also:
- Constant Field Values
-
DATA_TYPE_ARRAY
public static final byte DATA_TYPE_ARRAY
- See Also:
- Constant Field Values
-
DATA_TYPE_DATE
public static final byte DATA_TYPE_DATE
- See Also:
- Constant Field Values
-
DATA_TYPE_LONG_STRING
public static final byte DATA_TYPE_LONG_STRING
- See Also:
- Constant Field Values
-
DATA_TYPE_AS_OBJECT
public static final byte DATA_TYPE_AS_OBJECT
- See Also:
- Constant Field Values
-
DATA_TYPE_RECORDSET
public static final byte DATA_TYPE_RECORDSET
- See Also:
- Constant Field Values
-
DATA_TYPE_XML
public static final byte DATA_TYPE_XML
- See Also:
- Constant Field Values
-
DATA_TYPE_CUSTOM_CLASS
public static final byte DATA_TYPE_CUSTOM_CLASS
- See Also:
- Constant Field Values
-
DATA_TYPE_AMF3
public static final byte DATA_TYPE_AMF3
- See Also:
- Constant Field Values
-
DATA_TYPE_INTEGER
public static final byte DATA_TYPE_INTEGER
- See Also:
- Constant Field Values
-
DATA_TYPE_BYTEARRAY
public static final byte DATA_TYPE_BYTEARRAY
- See Also:
- Constant Field Values
-
DATA_TYPE_XML_TOP
public static final byte DATA_TYPE_XML_TOP
- See Also:
- Constant Field Values
-
DATA_TYPE_AMF3_UNDEFINED
public static final byte DATA_TYPE_AMF3_UNDEFINED
- See Also:
- Constant Field Values
-
DATA_TYPE_AMF3_NULL
public static final byte DATA_TYPE_AMF3_NULL
- See Also:
- Constant Field Values
-
DATA_TYPE_AMF3_BOOLEAN_FALSE
public static final byte DATA_TYPE_AMF3_BOOLEAN_FALSE
- See Also:
- Constant Field Values
-
DATA_TYPE_AMF3_BOOLEAN_TRUE
public static final byte DATA_TYPE_AMF3_BOOLEAN_TRUE
- See Also:
- Constant Field Values
-
DATA_TYPE_AMF3_INTEGER
public static final byte DATA_TYPE_AMF3_INTEGER
- See Also:
- Constant Field Values
-
DATA_TYPE_AMF3_NUMBER
public static final byte DATA_TYPE_AMF3_NUMBER
- See Also:
- Constant Field Values
-
DATA_TYPE_AMF3_STRING
public static final byte DATA_TYPE_AMF3_STRING
- See Also:
- Constant Field Values
-
DATA_TYPE_AMF3_XML_LEGACY
public static final byte DATA_TYPE_AMF3_XML_LEGACY
- See Also:
- Constant Field Values
-
DATA_TYPE_AMF3_DATE
public static final byte DATA_TYPE_AMF3_DATE
- See Also:
- Constant Field Values
-
DATA_TYPE_AMF3_ARRAY
public static final byte DATA_TYPE_AMF3_ARRAY
- See Also:
- Constant Field Values
-
DATA_TYPE_AMF3_OBJECT
public static final byte DATA_TYPE_AMF3_OBJECT
- See Also:
- Constant Field Values
-
DATA_TYPE_AMF3_XML_TOP
public static final byte DATA_TYPE_AMF3_XML_TOP
- See Also:
- Constant Field Values
-
DATA_TYPE_AMF3_BYTEARRAY
public static final byte DATA_TYPE_AMF3_BYTEARRAY
- See Also:
- Constant Field Values
-
AMF_LEVEL0
public static final byte AMF_LEVEL0
- See Also:
- Constant Field Values
-
AMF_LEVEL3
public static final byte AMF_LEVEL3
- See Also:
- Constant Field Values
-
AMF_DEFAULT_DESERIALIZE_CHARSETNAME
public static String AMF_DEFAULT_DESERIALIZE_CHARSETNAME
-
MILLS_PER_HOUR
public static final int MILLS_PER_HOUR
Number of milliseconds in an hour- See Also:
- Constant Field Values
-
type
protected int type
-
-
Method Detail
-
getType
public int getType()
Returns the data type for this object- Returns:
- object type DATA_TYPE_*
-
setType
public void setType(int type)
Sets the the data type for this object- Parameters:
type
- type DATA_TYPE_*
-
testNextByte
public static boolean testNextByte(java.nio.ByteBuffer data, int test)
Peek at the next value in data to see if its the test value- Parameters:
data
- binary data being deserializedtest
- value being tested- Returns:
- return true if the next byte in the buffer equals the test value
-
peekByte
public static int peekByte(java.nio.ByteBuffer data)
Return the next byte in the buffer without incrementing the data position- Parameters:
data
- binary data being deserialized- Returns:
- next byte in buffer
-
skipByte
public static int skipByte(java.nio.ByteBuffer data)
Skip forward one byte in the byte buffer- Parameters:
data
- binary data being deserialized- Returns:
- next byte in buffer
-
isObjStart
public static boolean isObjStart(java.nio.ByteBuffer data, AMFDataContextDeserialize context)
Returns true if next byte in data is object start- Parameters:
data
- binary data being deserializedcontext
- deserialization context- Returns:
- Returns true if next byte in data is object start
-
isAMF3Start
public static boolean isAMF3Start(java.nio.ByteBuffer data, AMFDataContextDeserialize context)
Returns true if next byte in data is AMF3 start- Parameters:
data
- binary data being deserializedcontext
- deserialization context- Returns:
- Returns true if next byte in data is object start
-
isArrayStart
public static boolean isArrayStart(java.nio.ByteBuffer data, AMFDataContextDeserialize context)
Returns true if next byte in data is an array start- Parameters:
data
- binary data being deserializedcontext
- deserialization context- Returns:
- Returns true if next byte in data is and array start
-
isMixedArrayStart
public static boolean isMixedArrayStart(java.nio.ByteBuffer data, AMFDataContextDeserialize context)
Returns true if next byte in data is mixed array start- Parameters:
data
- binary data being deserializedcontext
- deserialization context- Returns:
- Returns true if next byte in data is mixed array start
-
isObjEnd
public static boolean isObjEnd(java.nio.ByteBuffer data, AMFDataContextDeserialize context)
Returns true if next byte is object end- Parameters:
data
- binary data being deserializedcontext
- deserialization context- Returns:
- Returns true if next byte in object end
-
isByteArrayStart
public static boolean isByteArrayStart(java.nio.ByteBuffer data, AMFDataContextDeserialize context)
Returns true if next byte is ByteArray start- Parameters:
data
- binary data being deserializedcontext
- deserialization context- Returns:
- true if next byte in object end
-
getReference
public static AMFData getReference(java.nio.ByteBuffer data, AMFDataContextDeserialize context)
Get AMF3 object reference- Parameters:
data
- binary data being deserializedcontext
- deserialization context- Returns:
- null if not a reference else referenced object
-
deserializeInnerObject
public static AMFData deserializeInnerObject(java.nio.ByteBuffer data, AMFDataContextDeserialize context) throws java.io.IOException
Deserialize next item- Parameters:
data
- binary data being deserializedcontext
- deserialization context- Returns:
- deserialized object
- Throws:
java.io.IOException
-
createContextSerialize
public static AMFDataContextSerialize createContextSerialize()
Create an AMF3 serialization context- Returns:
- AMF3 serialization context
-
createContextSerialize
public static AMFDataContextSerialize createContextSerialize(int objectEncoding)
Create an AMF3 serialization context- Parameters:
objectEncoding
- object encoding level (see AMF_LEVEL*)- Returns:
- AMF3 serialization context
-
createContextDeserialize
public static AMFDataContextDeserialize createContextDeserialize()
Create an AMF3 deserialization context- Returns:
- AMF3 deserialization context
-
createContextDeserialize
public static AMFDataContextDeserialize createContextDeserialize(int objectEncoding)
Create an AMF3 deserialization context- Parameters:
objectEncoding
- object encoding level (see AMF_LEVEL*)- Returns:
- AMF3 deserialization context
-
serialize
public abstract void serialize(java.io.DataOutputStream out)
Serialize object to output stream- Parameters:
out
- Output stream
-
serialize
public abstract void serialize(java.io.DataOutputStream out, int objectEncoding)
Serialize object to output stream- Parameters:
out
- Output streamobjectEncoding
- object encoding level (see AMF_LEVEL*)
-
serialize
public abstract void serialize(java.io.DataOutputStream out, AMFDataContextSerialize context)
Serialize object to output stream- Parameters:
out
- Output streamcontext
- serialization context used by AMF3
-
serialize
public abstract byte[] serialize()
Serial object to byte array- Returns:
- serialized byte array
-
serialize
public abstract byte[] serialize(int objectEncoding)
Serial object to byte array- Parameters:
objectEncoding
- object encoding level (see AMF_LEVEL*)- Returns:
- serialized byte array
-
serialize
public abstract byte[] serialize(AMFDataContextSerialize context)
Serial object to byte array- Parameters:
context
- serialization context used by AMF3- Returns:
- serialized byte array
-
deserialize
public abstract void deserialize(java.nio.ByteBuffer data)
Deserialize data in byte buffer- Parameters:
data
- binary data
-
deserialize
public abstract void deserialize(java.nio.ByteBuffer data, AMFDataContextDeserialize context)
Deserialize data in byte buffer- Parameters:
data
- binary datacontext
- deserialization context used by AMF3
-
getValue
public abstract Object getValue()
Convert object to Java native class- Returns:
- java native class
-
triggerAMF3Switch
public static boolean triggerAMF3Switch(AMFData data)
Return true if the object is serialized differently in AMF3- Parameters:
data
- AMF object- Returns:
- true if the object is serialized differently in AMF3
-
-