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

tv.amwa.maj.io.mxf.impl

## Class RandomIndexItemImpl

- java.lang.Object
- - tv.amwa.maj.io.mxf.impl.RandomIndexItemImpl

- All Implemented Interfaces:
    Serializable, Cloneable, Comparable<RandomIndexItem>, MXFConstants, RandomIndexItem, XMLSerializable

      public class RandomIndexItemImpl
      extends Object
      implements XMLSerializable, Cloneable, Serializable, Comparable<RandomIndexItem>, RandomIndexItem, MXFConstants

  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `BODYSID_TAG`
    `static String` | `BYTEOFFSET_TAG`
    `static String` | `RANDOMINDEXITEM_TAG`

    - ### Fields inherited from interface tv.amwa.maj.io.mxf.MXFConstants

      `InstanceTag, InstanceUID, KLVFill, KLVFillOld, RP210_NAMESPACE, RP210_PREFIX`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RandomIndexItemImpl(int bodySID, long byteOffset)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `appendXMLChildren(Node parent)` Append extra child elements to the given parent node to serialize the value of an object to an XML fragment.
    `RandomIndexItem` | `clone()` Create a cloned copy of this random index item.
    `int` | `compareTo(RandomIndexItem o)` Compares this item to another random index item by byte offset.
    `boolean` | `equals(Object o)`
    `int` | `getBodySID()` Create a cloned copy of this RandomIndexPackItemImpl.
    `long` | `getByteOffset()` Create a cloned copy of this RandomIndexPackItemImpl.
    `String` | `getComment()` Include a comment when serializing a value to XML.
    `int` | `hashCode()`
    `void` | `setBodySID(int bodySID)` Create a cloned copy of this RandomIndexPackItemImpl.
    `void` | `setByteOffset(long byteOffset)` Create a cloned copy of this RandomIndexPackItemImpl.
    `String` | `toString()`

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

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

- - ### Field Detail

    - #### RANDOMINDEXITEM_TAG

          public static final String RANDOMINDEXITEM_TAG

      See Also:
        Constant Field Values

    - #### BODYSID_TAG

          public static final String BODYSID_TAG

      See Also:
        Constant Field Values

    - #### BYTEOFFSET_TAG

          public static final String BYTEOFFSET_TAG

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### RandomIndexItemImpl

          public RandomIndexItemImpl(@UInt32
                                     int bodySID,
                                     @UInt64
                                     long byteOffset)
                              throws IllegalArgumentException

      Throws:
        `IllegalArgumentException`

  - ### Method Detail

    - #### getBodySID

          @UInt32
          public int getBodySID()

      Create a cloned copy of this RandomIndexPackItemImpl.

      Specified by:
        `getBodySID` in interface `RandomIndexItem`
      Returns:
        Cloned copy of this RandomIndexPackItemImpl.
      See Also:
        `PartitionPack.getBodySID()`

    - #### setBodySID

          public void setBodySID(@UInt32
                                 int bodySID)
                          throws IllegalArgumentException

      Create a cloned copy of this RandomIndexPackItemImpl.

      Specified by:
        `setBodySID` in interface `RandomIndexItem`
      Parameters:
        `bodySID` - Body stream identifier within the indexed partition.
      Throws:
        `IllegalArgumentException` - Cannot set the body stream identifier to a negative value.
      See Also:
        `PartitionPack.setBodySID(int)`

    - #### getByteOffset

          @UInt64
          public long getByteOffset()

      Create a cloned copy of this RandomIndexPackItemImpl.

      Specified by:
        `getByteOffset` in interface `RandomIndexItem`
      Returns:
        Cloned copy of this RandomIndexPackItemImpl.
      See Also:
        `PartitionPack.getThisPartition()`

    - #### setByteOffset

          public void setByteOffset(@UInt64
                                    long byteOffset)
                             throws IllegalArgumentException

      Create a cloned copy of this RandomIndexPackItemImpl.

      Specified by:
        `setByteOffset` in interface `RandomIndexItem`
      Parameters:
        `byteOffset` - Byte offset of the indexed partition.
      Throws:
        `IllegalArgumentException` - Cannot set the byte offset to a negative value.
      See Also:
        `PartitionPack.setThisPartition(long)`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### appendXMLChildren

          public void appendXMLChildren(Node parent)

      Description copied from interface: `XMLSerializable`

      Append extra 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`
      Parameters:
        `parent` - XML parent element to append child nodes to.

    - #### 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`
      Returns:
        Comment to add as the first child node of the element representing this class.

    - #### compareTo

          public int compareTo(RandomIndexItem o)

      Description copied from interface: `RandomIndexItem`

      Compares this item to another random index item by byte offset. This method returns:

      - `-1` if this item indexes a partition before the given item;
      - `0` if this item is at the same position as the given item;
      - `1` if this item indexes a partition after the given item.
      Specified by:
        `compareTo` in interface `Comparable<RandomIndexItem>`
      Specified by:
        `compareTo` in interface `RandomIndexItem`
      Returns:
        If the indexed partition before, at the same position as or after the given partition's position in the MXF file.

    - #### clone

          public RandomIndexItem clone()

      Description copied from interface: `RandomIndexItem`

      Create a cloned copy of this random index item.

      Specified by:
        `clone` in interface `RandomIndexItem`
      Overrides:
        `clone` in class `Object`
      Returns:
        Cloned copy of this random index item.

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