public interface RandomIndexPack extends MXFUnit, MetadataObject
Represents a random index pack at the end of an MXF file that lists the byte offsets of all the partitions.
RandomIndexItem,
MXFFile.buildPartitionsTable()| Modifier and Type | Field and Description |
|---|---|
static UL |
ripKeyValue
Key defining the start of a random index pack.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addRandomIndexItem(int bodySID,
long byteOffset)
Add a random index item to this pack by its body stream identifier and byte offset.
|
void |
addRandomIndexItem(RandomIndexItem randomPartitionItem)
Add an existing random index item to this pack.
|
void |
clear()
Clears the partition table within this random index pack.
|
RandomIndexPack |
clone()
Creates a cloned copy of this random index pack.
|
int |
count()
Returns the number of partitions indexed by this random index pack.
|
int |
getLength()
Returns the overall length of the random index pack when encoded as
bytes, including the key and BER length.
|
RandomIndexItem[] |
getPartitionIndex()
Returns the array random index items of this random index pack.
|
long[] |
lookupPartitionOffsets(int bodySID)
Returns an ordered list of the byte offsets for partitions containing
the given body stream identifier.
|
void |
setPartitionIndex(RandomIndexItem[] partitionIndex)
Sets the array of random index items of this random index pack.
|
int |
writeAsBytes(ByteBuffer buffer)
Serializes this random index pack into its file-based KLV-encoded version in
the given buffer.
|
getUnitTypestatic final UL ripKeyValue
Key defining the start of a random index pack.
RandomIndexItem[] getPartitionIndex()
Returns the array random index items of this random index pack. Each partition of the MXF file indexed should have an entry in this array. The array is ordered by the byte offset of the partition.
PartitionPack.getThisPartition(),
TypeDefinitions.RandomIndexItem,
TypeDefinitions.RandomIndexItemArrayvoid setPartitionIndex(RandomIndexItem[] partitionIndex) throws NullPointerException
Sets the array of random index items of this random index pack. Each partition of the MXF file indexed should have an entry in this array. The items will be sorted into byte offset order.
partitionIndex - Array of random index items of this random index pack.NullPointerException - Cannot set the partition index with a null
array.@UInt32 int count()
Returns the number of partitions indexed by this random index pack.
@UInt64 long[] lookupPartitionOffsets(@UInt32 int bodySID)
Returns an ordered list of the byte offsets for partitions containing the given body stream identifier. The order of the partitions is the play order of the essence contained in the essence streams.
bodySID - Body stream identifier to query the partition offsets for.void clear()
Clears the partition table within this random index pack.
void addRandomIndexItem(@UInt32 int bodySID, @UInt64 long byteOffset) throws IllegalArgumentException
Add a random index item to this pack by its body stream identifier and byte offset. A random index item describes the location of a partition and which body stream it contains data for.
bodySID - Body stream identifier of the partition.byteOffset - Byte offset of the partition in the file, measured from
the beginning of the header partition.IllegalArgumentException - Cannot set the body stream identifier or
the byte offset to a negative value.addRandomIndexItem(RandomIndexItem),
PartitionPack.getThisPartition(),
PartitionPack.getBodySID()void addRandomIndexItem(RandomIndexItem randomPartitionItem) throws NullPointerException
Add an existing random index item to this pack. A random index item describes the location of a partition and which body stream it contains data for.
randomPartitionItem - Item to add to this pack.NullPointerException - Cannot add a null index item.addRandomIndexItem(int, long)@UInt32 int getLength()
Returns the overall length of the random index pack when encoded as bytes, including the key and BER length.
writeAsBytes(ByteBuffer)int writeAsBytes(ByteBuffer buffer) throws NullPointerException, InsufficientSpaceException
Serializes this random index pack into its file-based KLV-encoded version in
the given buffer. The buffer must have at least getLength() bytes remaining.
buffer - Buffer to write this random index pack into.NullPointerException - Cannot write this random index pack to a null buffer.InsufficientSpaceException - The given buffer does not have sufficient space
remaining.getLength()RandomIndexPack clone()
Creates a cloned copy of this random index pack.
(c)2007-2016 Richard Cartwright, all rights reserved. Licensed under Apache 2 license and subject to the AMWA IPR policy.