Media Authoring
with Java API

tv.amwa.maj.entity
Class KLVData

java.lang.Object
  extended by tv.amwa.maj.entity.InterchangeObject
      extended by tv.amwa.maj.entity.KLVData
All Implemented Interfaces:
Serializable, Cloneable, MAJCommon, InterchangeObject, KLVData, XMLSerializable

@AAFClass(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.")
public class KLVData
extends InterchangeObject
implements KLVData, Serializable, Cloneable, MAJCommon

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

THE COMMENTS FOR THIS CLASS ARE INCOMPLETE.

Author:
Richard Cartwright
See Also:
Serialized Form

Nested Class Summary
static class KLVData.XMLHandler
           
 
Nested classes/interfaces inherited from class tv.amwa.maj.entity.InterchangeObject
InterchangeObject.InterchangeObjectXMLHandler
 
Constructor Summary
KLVData(AUID key, byte[] value)
          Creates and initializes a new KLV data object, which contains user data specified with a key (SMPTE label), length, and value.
 
Method Summary
 void appendXMLChildren(Node parent)
          Append child elements to the given parent node to serialize the value of an object to an XML fragment.
 KLVData clone()
          Creates a cloned copy of this entity.
 boolean equals(Object o)
          Two KLV data values are equal if they have the same key and matching byte array values.
 AUID getKey()
          Returns the key of this KLV data.
 int getLength()
          Returns the size of the data buffer for this KLV data.
 byte[] getValue()
          Returns the value of this KLV data.
 int hashCode()
          Returns a hash code value for this interchange object.
 void setPropertiesFromInterface(KLVData castFrom)
           
 void setValue(byte[] value)
          Sets the data value and length of the KLV data from the given value.
 
Methods inherited from class tv.amwa.maj.entity.InterchangeObject
castFromInterface, countProperties, createOptionalPropertyValue, disableGenerationTracking, enableGenerationTracking, getDefinition, getGeneration, getGenerationAUID, getProperties, getPropertyValue, isGenerationTracked, isPropertyPresent, omitOpionalProperty, registerImplementation, setPropertiesFromInterface, setPropertyValue, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface tv.amwa.maj.iface.InterchangeObject
countProperties, createOptionalPropertyValue, disableGenerationTracking, enableGenerationTracking, getDefinition, getGeneration, getGenerationAUID, getProperties, getPropertyValue, isGenerationTracked, isPropertyPresent, omitOpionalProperty, setPropertyValue
 
Methods inherited from interface tv.amwa.maj.entity.MAJCommon
toString
 

Constructor Detail

KLVData

public KLVData(AUID key,
               @DataBuffer
               byte[] 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 Dictionary.registerKLVDataKey(AUID, TypeDefinition) 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 TypeDefinitionRename to rename an existing type.
Method Detail

setPropertiesFromInterface

public final void setPropertiesFromInterface(KLVData castFrom)
See Also:
InterchangeObject.setPropertiesFromInterface(tv.amwa.maj.iface.InterchangeObject)

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.

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

getValue

@AAFProperty(uuid1=50397712,
             uuid2=512,
             uuid3=0,
             uuid4={6,14,43,52,1,1,1,2},
             definedName="Value",
             typeName="Opaque",
             optional=false,
             uniqueIdentifier=false,
             pid=20737)
public byte[] getValue()
Description copied from interface: KLVData

Returns the value of this KLV data.

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

setValue

public void setValue(byte[] value)
              throws NullPointerException
Description copied from interface: KLVData

Sets the data value and length of the KLV data from the given value.

Specified by:
setValue in interface KLVData
Parameters:
value - Value to set for the KLV data.
Throws:
NullPointerException - The given buffer for the data value is null.

equals

public boolean equals(Object o)

Two KLV data values are equal if they have the same key and matching byte array values.

Specified by:
equals in interface MAJCommon
Overrides:
equals in class Object
Parameters:
o - Object to test for equality with.
Returns:
Is the given object equals to this value?
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Description copied from interface: MAJCommon

Returns a hash code value for this interchange object.

Specified by:
hashCode in interface MAJCommon
Overrides:
hashCode in class Object
Returns:
Hash code value for this interchange object.
See Also:
Object.hashCode()

clone

public KLVData clone()
Description copied from interface: MAJCommon

Creates a cloned copy of this entity. The clone will be initialized to have the same value as this value but exists independently from then on. Changes to this value will not effect the clone and changes to the clone will not effect this. MAJ API clones are true deep clones with no shared references to areas of memory within the original.

This method does not throw a CloneNotSupportedException as all entity values must implement the Cloneable interface. If a cloning error does occur, a null value will be returned but this is very unlikely to happen.

Specified by:
clone in interface MAJCommon
Overrides:
clone in class Object
Returns:
Independent clone of this value, which is a deep copy.
See Also:
Object.clone()

appendXMLChildren

public void appendXMLChildren(Node parent)
Description copied from interface: XMLSerializable

Append child elements to the given parent node to serialize the value of an object to an XML fragment. Methods of the XMLBuilder class are provided to help with this process.

Specified by:
appendXMLChildren in interface XMLSerializable
Overrides:
appendXMLChildren in class InterchangeObject
Parameters:
parent - XML parent element to append child nodes to.

Media Authoring
with Java API

(c) 2007-2008 Richard Cartwright, all rights reserved. Subject to the terms of the AAF SDK Public Source License.