KLVDataImpl (Media Authoring with Java API)
Date: 2016-02-05

tv.amwa.maj.model.impl

## Class KLVDataImpl

- java.lang.Object
- - tv.amwa.maj.model.impl.InterchangeObjectImpl
  - - tv.amwa.maj.model.impl.KLVDataImpl

- All Implemented Interfaces:
    Serializable, Cloneable, MediaEntity, MetadataObject, XMLSerializable, InterchangeObject, KLVData

      @MediaClass(uuid1=218169601,
                  uuid2=257,
                  uuid3=16384,
                  uuid4={6,14,43,52,2,6,1,1},
                  definedName="KLVData",
                  description="The KLVData class contains user data specified with a key (SMPTE label), length, and value.",
                  symbol="KLVData")
      public class KLVDataImpl
      extends InterchangeObjectImpl
      implements KLVData, Serializable, XMLSerializable, Cloneable

  Implements a container for user data specified with a key (SMPTE label), length and value. SMPTE KLV's are specified in SMPTE&336M.

  The byte order of the KLV data value is the same as the byte order of the byte buffer passed to initialize or set the value.

  See Also:
    `TypeDefinitions.KLVDataStrongReference`, `TypeDefinitions.KLVDataStrongReferenceVector`, Serialized Form

- - ### Field Summary

    - ### Fields inherited from class tv.amwa.maj.model.impl.InterchangeObjectImpl

      `ObjectClassPropertyID`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `KLVDataImpl()`
    `KLVDataImpl(AUID key, ByteBuffer value)` Creates and initializes a new KLV data object, which contains user data specified with a key (SMPTE label), length, and value.
    `KLVDataImpl(ByteBuffer keyAndValue)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `KLVData` | `clone()` Create a cloned copy of this interchange object.
    `String` | `getComment()` Include a comment when serializing a value to XML.
    `AUID` | `getKey()` Returns the key of this KLV data.
    `byte[]` | `getKLVDataValuePersist()`
    `int` | `getLength()` Returns the size of the data buffer for this KLV data, which includes the key.
    `ByteBuffer` | `getValue()` Returns the value of this KLV data, including the key.
    `static ByteBuffer` | `initializeKLVDataValue()`
    `void` | `setKLVDataValuePersist(byte[] klvDataValue)`
    `void` | `setValue(ByteBuffer keyAndValue)` Sets the key and data value of the KLV data from the given byte array.

    - ### Methods inherited from class tv.amwa.maj.model.impl.InterchangeObjectImpl

      `addApplicationPlugin, appendXMLChildren, clearApplicationPlugins, containsApplicationPlugin, containsApplicationPlugin, countApplicationPlugins, deepEquals, disableGenerationTracking, enableGenerationTracking, equals, getApplicationPlugins, getGeneration, getLinkedGenerationID, getLinkedGenerationIDString, getObjectClass, getPersistentID, getPersistentIndex, hashCode, isGenerationTracked, removeApplicationPlugin, removeApplicationPlugin, setLinkedGenerationID, setLinkedGenerationIDString, setObjectClass, setPersistentID, setPersistentIndex, toString`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface tv.amwa.maj.model.InterchangeObject

      `addApplicationPlugin, clearApplicationPlugins, containsApplicationPlugin, containsApplicationPlugin, countApplicationPlugins, deepEquals, disableGenerationTracking, enableGenerationTracking, equals, getApplicationPlugins, getGeneration, getLinkedGenerationID, getObjectClass, isGenerationTracked, removeApplicationPlugin, removeApplicationPlugin, setLinkedGenerationID, setObjectClass, toString`

    - ### Methods inherited from interface tv.amwa.maj.industry.MediaEntity

      `getPersistentID, setPersistentIndex`

    - ### Methods inherited from interface tv.amwa.maj.io.xml.XMLSerializable

      `appendXMLChildren`

- - ### Constructor Detail

    - #### KLVDataImpl

          public KLVDataImpl()

    - #### KLVDataImpl

          public KLVDataImpl(AUID key,
                             @DataBuffer
                             ByteBuffer value)
                      throws NullPointerException,
                             NotValidKeyException

      Creates and initializes a new KLV data object, which contains user data specified with a key (SMPTE label), length, and value. The key must have been previously registered using `DictionaryImpl#registerKLVDataKey(AUIDImpl, TypeDefinitionImpl)` in order to use the byte swapping functionality of the type model.

      Parameters:
        `key` - Key associated with the data value.
        `value` - Value associated with the key.
      Throws:
        `NullPointerException` - One or both of the arguments is `null`.
        `NotValidKeyException` - The given key must not resolve to a built-in type. For most purposes, use `TypeDefinitionRenameImpl` to rename an existing type.

    - #### KLVDataImpl

          public KLVDataImpl(@DataBuffer
                             ByteBuffer keyAndValue)
                      throws NullPointerException,
                             IllegalArgumentException

      Throws:
        `NullPointerException`
        `IllegalArgumentException`

  - ### Method Detail

    - #### getKey

          public AUID getKey()

      Description copied from interface: `KLVData`

      Returns the key of this KLV data.

      Specified by:
        `getKey` in interface `KLVData`
      Returns:
        Key of the KLV data.

    - #### getLength

          public int getLength()

      Description copied from interface: `KLVData`

      Returns the size of the data buffer for this KLV data, which includes the key.

      Specified by:
        `getLength` in interface `KLVData`
      Returns:
        Length of the value of the KLV data.

    - #### getValue

          @MediaProperty(uuid1=50397712,
                         uuid2=512,
                         uuid3=0,
                         uuid4={6,14,43,52,1,1,1,2},
                         definedName="KLVDataValue",
                         aliases="Value",
                         typeName="Opaque",
                         optional=false,
                         uniqueIdentifier=false,
                         pid=20737,
                         symbol="KLVDataValue")
          public ByteBuffer getValue()

      Description copied from interface: `KLVData`

      Returns the value of this KLV data, including the key.

      Specified by:
        `getValue` in interface `KLVData`
      Returns:
        Value of the KLV data.

    - #### setValue

          @MediaPropertySetter(value="KLVDataValue")
          public void setValue(ByteBuffer keyAndValue)
                                                                   throws NullPointerException,
                                                                          IllegalArgumentException

      Description copied from interface: `KLVData`

      Sets the key and data value of the KLV data from the given byte array. The key is assumed to be the first 16 bytes of the value.

      Specified by:
        `setValue` in interface `KLVData`
      Parameters:
        `keyAndValue` - Value to set for the KLV data.
      Throws:
        `NullPointerException` - The given buffer for the data value is `null`.
        `IllegalArgumentException` - A buffer is too short. It must contain a key of of 16-bytes.

    - #### initializeKLVDataValue

          public static final ByteBuffer initializeKLVDataValue()

    - #### clone

          public KLVData clone()

      Description copied from interface: `InterchangeObject`

      Create a cloned copy of this interchange object.

      Specified by:
        `clone` in interface `MediaEntity`
      Specified by:
        `clone` in interface `InterchangeObject`
      Specified by:
        `clone` in interface `KLVData`
      Overrides:
        `clone` in class `InterchangeObjectImpl`
      Returns:
        Cloned copy of this interchange object.

    - #### getComment

          public String getComment()

      Description copied from interface: `XMLSerializable`

      Include a comment when serializing a value to XML. The comment will be inserted as the first child node of the element representing the class.

      Specified by:
        `getComment` in interface `XMLSerializable`
      Overrides:
        `getComment` in class `InterchangeObjectImpl`
      Returns:
        Comment to add as the first child node of the element representing this class.

    - #### getKLVDataValuePersist

          public byte[] getKLVDataValuePersist()

    - #### setKLVDataValuePersist

          public void setKLVDataValuePersist(byte[] klvDataValue)

(c)2007-2016 Richard Cartwright, all rights reserved. Licensed under Apache 2 license and subject to the AMWA IPR policy.