Class 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.

    • Constructor Detail

      • AMFData

        public AMFData()
    • 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 deserialized
        test - 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 deserialized
        context - 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 deserialized
        context - 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 deserialized
        context - 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 deserialized
        context - 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 deserialized
        context - 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 deserialized
        context - 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 deserialized
        context - 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 deserialized
        context - 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 stream
        objectEncoding - 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 stream
        context - 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 data
        context - 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