com.avaya.ccs.api

## Interface DataI

-     public interface DataI

  The `DataI` object represents attached data on a contact in the Contact Center associated with an `InteractionI` object.

  The data stored in this object can be one of three `DataFormat` values;

  - `DataFormat.BIN`: binary data stored in a byte array
  - `DataFormat.STR`: textual data stored in a string
  - `DataFormat.KVP`: key value pair data stored in a map

  The client application can use the static factory methods on this object to create a `DataI` object with content in one of the three formats specified above. Creating a `DataI` object would be a precursor to invoking `InteractionI.setData(com.avaya.ccs.api.DataI)`.

- - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static DataI` | `create(byte[] binData)` A factory method to create a `DataI` object containing binary data represented by a byte array.
    `static DataI` | `create(java.util.Map<java.lang.String,java.lang.String> kvpData)` A factory method to create a `DataI` object containing key value pair data represented in a map.
    `static DataI` | `create(java.lang.String strData)` A factory method to create a `DataI` object containing string data.
    `byte[]` | `getBinaryData()` If `getFormat()` returns `DataFormat.BIN`, this `DataI` object will contain binary data which can be retrieved by this method.
    `DataFormat` | `getFormat()`
    `java.util.Map<java.lang.String,java.lang.String>` | `getKvpData()` If `getFormat()` returns `DataFormat.KVP`, this `DataI` object will contain key value pair data which can be retrieved by this method.
    `java.lang.String` | `getStringData()` If `getFormat()` returns `DataFormat.STR`, this `DataI` object will contain string data which can be retrieved by this method.

- - ### Method Detail

    - #### getFormat

          DataFormat getFormat()

      Returns:
        the `DataFormat` of the data stored in this object

    - #### getBinaryData

          byte[] getBinaryData()

      If `getFormat()` returns `DataFormat.BIN`, this `DataI` object will contain binary data which can be retrieved by this method.
      Returns:
        a byte array containing binary data or an empty byte array if binary data is not stored in this object

    - #### getKvpData

          java.util.Map<java.lang.String,java.lang.String> getKvpData()

      If `getFormat()` returns `DataFormat.KVP`, this `DataI` object will contain key value pair data which can be retrieved by this method.
      Returns:
        a map containing key value pair data, or an empty map if kvp data is not stored in this object

    - #### getStringData

          java.lang.String getStringData()

      If `getFormat()` returns `DataFormat.STR`, this `DataI` object will contain string data which can be retrieved by this method.
      Returns:
        a string containing textual data or `null` if string data is not stored in this object

    - #### create

          static DataI create(java.util.Map<java.lang.String,java.lang.String> kvpData)
                       throws InvalidArgumentException

      A factory method to create a `DataI` object containing key value pair data represented in a map.
      Parameters:
        `kvpData` - a map of key value pair data to be stored in this object
      Returns:
        a new `DataI` object representing the supplied kvp data
      Throws:
        `InvalidArgumentException` - if the map argument is `null` or empty

    - #### create

          static DataI create(java.lang.String strData)
                       throws InvalidArgumentException

      A factory method to create a `DataI` object containing string data.
      Parameters:
        `strData` - a string containing textual data to be stored in this object
      Returns:
        a new `DataI` object representing the supplied string data
      Throws:
        `InvalidArgumentException` - if the string argument is `null` or empty

    - #### create

          static DataI create(byte[] binData)
                       throws InvalidArgumentException

      A factory method to create a `DataI` object containing binary data represented by a byte array.
      Parameters:
        `binData` - a byte array containing binary data to be stored in this object
      Returns:
        a new `DataI` object representing the supplied binary data
      Throws:
        `InvalidArgumentException` - if the byte array argument is `null` or empty