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

tv.amwa.maj.io.mxf

## Class KLVObject

- java.lang.Object
- - tv.amwa.maj.io.mxf.KLVObject

-     public class KLVObject
      extends Object

  Implementation of a KLV triple value.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `KLVObject.KeyFormat`
    `static class` | `KLVObject.LengthFormat`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `KLVObject()` Construct a KLV object where nothing is yet known about it.
    `KLVObject(UL theUL)` Construct a KLV object with the given key.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `describeSource()` Get a textual description of where this KLV object came from.
    `String` | `describeSourceLocation()` Get a textual description of exactly where this item came from, including its location.
    `ByteBuffer` | `getData()`
    `long` | `getDataBaseOffset()`
    `GenericContainerElementKind` | `getGCElementKind()`
    `int` | `getGCTrackNumber()`
    `int` | `getKLSize()` Get the size of the key and length of this KLV object.
    `long` | `getLength()`
    `long` | `getLocation()` Get the location of this KLV object within its ultimate parent.
    `UL` | `getUL()` Get this KLV objects universal label or key.
    `int` | `readData(int size)`
    `int` | `readDataFrom(long offset)`
    `int` | `readDataFrom(long offset, int size)`
    `int` | `readKL()`
    `void` | `setDataBaseOffset(long dataBaseOffset)`
    `void` | `setDestination(MXFFileImpl file)` Set the destination details for this object when written to a file, using the current file location.
    `void` | `setDestination(MXFFileImpl file, long location)` Set the destination details for this object when written to a file, with the option to provide the file location.
    `void` | `setKLSize(int klSize)` Set the size of the key and length of this KLV object.
    `void` | `setLength(long length)`
    `void` | `setSource(MXFFileImpl file)` Set the source details when an object has been read from a file using the current position.
    `void` | `setSource(MXFFileImpl file, long location)` Set the source details when an object has been read from a file, with the option to provide a byte offset.
    `void` | `setUL(UL newUL)` Set this KLV objects universal label or key.
    `int` | `writeData()`
    `int` | `writeData(int size)`
    `int` | `writeDataFrom(long start)`
    `int` | `writeDataFrom(long start, int size)`
    `int` | `writeDataFromTo(long offset, long start)`
    `int` | `writeDataFromTo(long offset, long start, int size)`
    `int` | `writeDataTo(byte[] buffer, long start, long offset, int size)`
    `int` | `writeDataTo(long offset)`
    `int` | `writeDataTo(long offset, int size)`
    `int` | `writeKL()`
    `int` | `writeKL(int lengthSize)`

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

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### KLVObject

          public KLVObject()

      Construct a KLV object where nothing is yet known about it.

    - #### KLVObject

          public KLVObject(UL theUL)

      Construct a KLV object with the given key.

      Parameters:
        `theUL` - Key for the new KLV object.

  - ### Method Detail

    - #### setSource

          public void setSource(MXFFileImpl file,
                                @Int64
                                long location)
                         throws NullPointerException

      Set the source details when an object has been read from a file, with the option to provide a byte offset.

      Parameters:
        `file` - The source file of this KLV object.
        `location` - The byte offset of the start of the key of the KLV from the start of the file, or current position if -1.
      Throws:
        `NullPointerException` - Cannot set the source of this KLV object to be a `null` value.

    - #### setSource

          public void setSource(MXFFileImpl file)
                         throws NullPointerException

      Set the source details when an object has been read from a file using the current position.

      Parameters:
        `file` - The source file of this KLV object.
      Throws:
        `NullPointerException` - Cannot set the source of this KLV object to be a `null` value.

    - #### setDestination

          public void setDestination(MXFFileImpl file,
                                     @Int64
                                     long location)
                              throws NullPointerException

      Set the destination details for this object when written to a file, with the option to provide the file location.

      Parameters:
        `file` - The destination file for the KLV object.
        `location` - The byte offset of the start of the key of the KLV from the start of the file, or if -1 then the current position in that file will be used.
      Throws:
        `NullPointerException` - Cannot set the destination for this KLV object to be a `null` value.

    - #### setDestination

          public void setDestination(MXFFileImpl file)
                              throws NullPointerException

      Set the destination details for this object when written to a file, using the current file location.

      Parameters:
        `file` - The destination file for the KLV object.
        `location` - The byte offset of the start of the key of the KLV from the start of the file, or if -1 then the current position in that file will be used.
      Throws:
        `NullPointerException` - Cannot set the destination for this KLV object to be a `null` value.

    - #### getUL

          public UL getUL()

      Get this KLV objects universal label or key. Note that this could be `null` if not yet set.

      Returns:
        The KLV object's universal label.

    - #### setUL

          public void setUL(UL newUL)

      Set this KLV objects universal label or key.

      Parameters:
        `newUL` - New universal label for this KLV object, which can be `null`.

    - #### getLocation

          @Int64
          public long getLocation()

      Get the location of this KLV object within its ultimate parent.

      Returns:
        Location of this KLV object as an offset into the source file.

    - #### describeSource

          public String describeSource()

      Get a textual description of where this KLV object came from.

      Returns:
        Description of where this KLV object came from.

    - #### describeSourceLocation

          public String describeSourceLocation()

      Get a textual description of exactly where this item came from, including its location.

      Returns:
        Textual description of exactly where this KLV object came from.

    - #### getKLSize

          @Int32
          public int getKLSize()

      Get the size of the key and length of this KLV object. This does not include the size of the value.

      Returns:
        Size of the key and length of this KLV object.

    - #### setKLSize

          public void setKLSize(@Int32
                                int klSize)

      Set the size of the key and length of this KLV object. This does not include the size of the value. Note that you cannot change the source size.

      Parameters:
        `klSize` - Size to set for the key and length.

    - #### getGCElementKind

          public GenericContainerElementKind getGCElementKind()

    - #### getGCTrackNumber

          @UInt32
          public int getGCTrackNumber()

    - #### getDataBaseOffset

          @Int64
          public long getDataBaseOffset()

    - #### setDataBaseOffset

          public void setDataBaseOffset(@Int64
                                        long dataBaseOffset)

    - #### readKL

          @Int32
          public int readKL()

    - #### readData

          @Int32
          public int readData(@Int32
                                     int size)

    - #### readDataFrom

          public int readDataFrom(@MXFPosition
                                  long offset,
                                  int size)

    - #### readDataFrom

          public int readDataFrom(@MXFPosition
                                  long offset)

    - #### writeKL

          @Int32
          public int writeKL(@Int32
                                    int lengthSize)

    - #### writeKL

          @Int32
          public int writeKL()

    - #### writeData

          public int writeData(int size)

    - #### writeData

          public int writeData()

    - #### writeDataFrom

          public int writeDataFrom(@MXFPosition
                                   long start,
                                   int size)

    - #### writeDataFrom

          public int writeDataFrom(@MXFPosition
                                   long start)

    - #### writeDataTo

          public int writeDataTo(@MXFPosition
                                 long offset,
                                 int size)

    - #### writeDataTo

          public int writeDataTo(@MXFPosition
                                 long offset)

    - #### writeDataFromTo

          public int writeDataFromTo(@MXFPosition
                                     long offset,
                                     @MXFPosition
                                     long start,
                                     int size)

    - #### writeDataFromTo

          public int writeDataFromTo(@MXFPosition
                                     long offset,
                                     @MXFPosition
                                     long start)

    - #### writeDataTo

          public int writeDataTo(@UInt8Array
                                 byte[] buffer,
                                 @MXFPosition
                                 long start,
                                 @MXFPosition
                                 long offset,
                                 int size)

    - #### getLength

          @MXFLength
          public long getLength()

    - #### setLength

          public void setLength(@MXFLength
                                long length)

    - #### getData

          public ByteBuffer getData()

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