Class AMFDataByteArray

Object
com.wowza.wms.amf.AMFData
com.wowza.wms.amf.AMFDataByteArray

public class AMFDataByteArray extends AMFData

AMFDataByteArray: class for marshalling data between Wowza Pro server and Flash client. This class is a simple byte array.

  • Constructor Details

    • AMFDataByteArray

      public AMFDataByteArray()
      Create empty AMFDataByteArray object
    • AMFDataByteArray

      public AMFDataByteArray(byte[] data)
      Deserialize entire byte array and create AMFDataByteArray object. Note: This is for AMF3 deserialization and cannot be used to create an AMFDataByteArray with the passed in data. To create a new AMDDataByteArray from either a byte[] or ByteBuffer, use the static wrap method.
      Parameters:
      data - binary data
    • AMFDataByteArray

      public AMFDataByteArray(byte[] data, int offset, int size)
      Deserialize data array starting at offest for size bytes and create AMFDataByteArray object. Note: This is for AMF3 deserialization and cannot be used to create an AMFDataByteArray with the passed in data. To create a new AMDDataByteArray from either a byte[] or ByteBuffer, use the static wrap method.
      Parameters:
      data - binary data
      offset - starting offset into data
      size - size of data to deserialize
    • AMFDataByteArray

      public AMFDataByteArray(ByteBuffer data)
      Deserialize entire data array and create AMFDataByteArray object. Note: This is for AMF3 deserialization and cannot be used to create an AMFDataByteArray with the passed in data. To create a new AMDDataByteArray from either a byte[] or ByteBuffer, use the static wrap method.
      Parameters:
      data - binary data
    • AMFDataByteArray

      public AMFDataByteArray(ByteBuffer data, AMFDataContextDeserialize context)
      Deserialize entire data array and create AMFDataByteArray object. Note: This is for AMF3 deserialization and cannot be used to create an AMFDataByteArray with the passed in data. To create a new AMDDataByteArray from either a byte[] or ByteBuffer, use the static wrap method.
      Parameters:
      data - binary data
      context - deserialization context (used for AMF3 decoding)
  • Method Details

    • size

      public int size()
      Returns the number of bytes in the byte array
      Returns:
      number of bytes in the array
    • toArray

      public byte[] toArray()
      Returns the underlying data buffer (not a copy)
      Returns:
      data buffer (not a copy)
    • toByteBuffer

      public ByteBuffer toByteBuffer()
      Wraps the underlying data buffer with a ByteBuffer object.
      Returns:
      byte[] wrapped as ByteBuffer
    • wrap

      public static AMFDataByteArray wrap(byte[] data)
      Wraps a byte[] into a AMFDataByteArray. Note: This method does not copy the array.
      Parameters:
      data - byte[] data
      Returns:
      wrapped byte[]
    • wrap

      public static AMFDataByteArray wrap(ByteBuffer data)
      Wraps a ByteBuffer into a AMFDataByteArray. Note: This method only copies the ByteBuffer data if the ByteBuffer.array() method fails.
      Parameters:
      data - ByteBuffer data
      Returns:
      wrapped ByteBuffer
    • getValue

      public Object getValue()
      Returns the underlying byte[] data buffer
      Specified by:
      getValue in class AMFData
      Returns:
      java native class
    • deserialize

      public void deserialize(ByteBuffer data)
      Description copied from class: AMFData
      Deserialize data in byte buffer
      Specified by:
      deserialize in class AMFData
      Parameters:
      data - binary data
    • deserialize

      public void deserialize(ByteBuffer data, AMFDataContextDeserialize context)
      Description copied from class: AMFData
      Deserialize data in byte buffer
      Specified by:
      deserialize in class AMFData
      Parameters:
      data - binary data
      context - deserialization context used by AMF3
    • serialize

      public void serialize(DataOutputStream out)
      Description copied from class: AMFData
      Serialize object to output stream
      Specified by:
      serialize in class AMFData
      Parameters:
      out - Output stream
    • serialize

      public void serialize(DataOutputStream out, int objectEncoding)
      Description copied from class: AMFData
      Serialize object to output stream
      Specified by:
      serialize in class AMFData
      Parameters:
      out - Output stream
      objectEncoding - object encoding level (see AMF_LEVEL*)
    • serialize

      public void serialize(DataOutputStream out, AMFDataContextSerialize context)
      Description copied from class: AMFData
      Serialize object to output stream
      Specified by:
      serialize in class AMFData
      Parameters:
      out - Output stream
      context - serialization context used by AMF3
    • serialize

      public byte[] serialize()
      Description copied from class: AMFData
      Serial object to byte array
      Specified by:
      serialize in class AMFData
      Returns:
      serialized byte array
    • serialize

      public byte[] serialize(int objectEncoding)
      Description copied from class: AMFData
      Serial object to byte array
      Specified by:
      serialize in class AMFData
      Parameters:
      objectEncoding - object encoding level (see AMF_LEVEL*)
      Returns:
      serialized byte array
    • serialize

      public byte[] serialize(AMFDataContextSerialize context)
      Description copied from class: AMFData
      Serial object to byte array
      Specified by:
      serialize in class AMFData
      Parameters:
      context - serialization context used by AMF3
      Returns:
      serialized byte array
    • compress

      public int compress()
      Compress the internal buffer using the ZLIB compression library
      Returns:
      size of compressed buffer
    • decompress

      public int decompress()
      Decompress the internal buffer using the ZLIB compression library
      Returns:
      size of decompressed buffer
    • toString

      public String toString()
      Return object as formatted string
      Overrides:
      toString in class Object