public interface Partition extends Cloneable
Represents a partition of an MXF file, which is the top-level sub-division of an MXF file. An MXF file is made up of a sequence of a header partition, followed by zero or more body partitions and an optional footer partition. All partitions are self-describing with a partition pack at the start. Depending on their type, partitions may contain header metadata, stream data and index table segments.
MXFFile.buildPartitionsTable(),
PartitionPack| Modifier and Type | Field and Description |
|---|---|
static long |
SIZE_UNKNOWN
Size of the partition is not known and will need to be calculated.
|
| Modifier and Type | Method and Description |
|---|---|
Partition |
clone()
Create a cloned copy of this partition.
|
long |
getActualSize()
Returns the current size allocated for the partition, including any fill.
|
long |
getInitialSize()
Returns the initial partition size given for this partition that is used to calculate
the minimum allowed size for the partition.
|
PartitionPack |
getPartitionPack()
Returns the partition pack that describes this partition, including its size and what it
contains.
|
boolean |
hasEssenceContainer()
Determines whether this partition has an essence container, indicating the
presence of (part of) a body stream.
|
boolean |
hasHeaderMetadata()
Determines whether this partition contains header metadata.
|
boolean |
hasIndexTable()
Determines whether this partition contains index table data.
|
HeaderMetadata |
readHeaderMetadata()
Returns the header metadata contained within the partition, if any.
|
IndexTableSegment |
readIndexTableSegment()
Reads the index table segment of this partition, if any is
present.
|
void |
setInitialDataSize(long initialSize)
Sets the initial partition size for this partition that is used to calculate the
minimum allowed size for the partition.
|
void |
setPartitionPackPadding(long paddingFillSize)
Set the amount of padding to include after each significant entry in the partition,
allowing space for the metadata to expand over time.
|
void |
updateSizes()
Update the size of partition based on the best information known at this time.
|
void |
writeHeaderMetadata(Preface preface,
long headerSize)
Write the header metadata of this partition using that provided
in the given preface.
|
void |
writeIndexTableSegment(IndexTableSegment indexSegment,
long segmentLength) |
void |
writeSingleIndexSegment(IndexTableSegment indexTableSegment) |
static final long SIZE_UNKNOWN
Size of the partition is not known and will need to be calculated.
setInitialDataSize(long),
Constant Field ValuesPartitionPack getPartitionPack()
Returns the partition pack that describes this partition, including its size and what it contains.
HeaderPartition.getPartitionPack(),
FooterPartition.getPartitionPack(),
BodyPartition.getPartitionPack()void setPartitionPackPadding(long paddingFillSize)
throws IllegalArgumentException
Set the amount of padding to include after each significant entry in the partition, allowing space for the metadata to expand over time.
paddingFillSize - Size of padding to include after the partition.IllegalArgumentException - Cannot set the padding size to a negative value.Padded.getPaddingFillSize(),
Padded.setPaddingFillSize(long)HeaderMetadata readHeaderMetadata() throws NullPointerException
Returns the header metadata contained within the partition, if any.
null if no header
metadata is present.NullPointerException - The partition's MXF file is null which may
occur if this partition is being created unattached.hasHeaderMetadata(),
writeHeaderMetadata(Preface, long)boolean hasHeaderMetadata()
Determines whether this partition contains header metadata. All header partitions must contain header metadata. Other partitions may contain header metadata.
readHeaderMetadata(),
writeHeaderMetadata(Preface, long)void writeHeaderMetadata(Preface preface, long headerSize) throws NullPointerException, InsufficientSpaceException, IOException
Write the header metadata of this partition using that provided in the given preface. Previous header metadata will be overwritten. Note that sufficient space must be available.
headerMetadata - Header metadata to associate with this partition.headerSize - Number of bytes the encoded header should fit within, including filler.NullPointerException - Cannot associate null header metadata with this partition.InsufficientSpaceException - Calculations based on partition sizes shows that insufficient space
is available to write this header metadata.IOException - Problem occurred writing to the filesystem.readHeaderMetadata(),
hasHeaderMetadata(),
#calculateMinimumHeaderMetadataSize(Preface)IndexTableSegment readIndexTableSegment() throws NullPointerException
Reads the index table segment of this partition, if any is present.
null if no index data is
present.NullPointerException - The partition's MXF file is null which may
occur if this partition is being created unattached.hasIndexTable()void writeIndexTableSegment(IndexTableSegment indexSegment, long segmentLength) throws NullPointerException, InsufficientSpaceException, IOException
void writeSingleIndexSegment(IndexTableSegment indexTableSegment) throws NullPointerException, InsufficientSpaceException, IOException
boolean hasIndexTable()
Determines whether this partition contains index table data. The partition may contain a complete index table or just a segment of an index table stream.
readIndexTableSegment()boolean hasEssenceContainer()
Determines whether this partition has an essence container, indicating the presence of (part of) a body stream.
long getInitialSize()
Returns the initial partition size given for this partition that is used to calculate the minimum allowed size for the partition. Note that this value does not necessarily reflect the actual size of the partition.
SIZE_UNKNOWN,
getActualSize()void setInitialDataSize(long initialSize)
Sets the initial partition size for this partition that is used to calculate the
minimum allowed size for the partition. Use a value of SIZE_UNKNOWN to get MAJ to
calculate the size. Note that the implementation will expand the size
of the partition beyond the minimum given with this method if required. The size is
specified excluding the size of the partition pack.
initialSize - Initial partition size.SIZE_UNKNOWN,
getActualSize()void updateSizes()
Update the size of partition based on the best information known at this time.
MXFFile.updatePackSizes()long getActualSize()
Returns the current size allocated for the partition, including any fill. This size may be updated during writing.
getInitialSize()Partition clone()
Create a cloned copy of this partition.
(c)2007-2016 Richard Cartwright, all rights reserved. Licensed under Apache 2 license and subject to the AMWA IPR policy.