public interface MXFFile extends Cloneable
Represents and provides access to the components of an MXF file, including the partitions that it contains.
To open an MXF file and to start reading it, call static method MXFFactory.readPartitions(String)
and then access the data it contains using the methods of this class.
MXFFactory.readPartitions(String)| Modifier and Type | Method and Description |
|---|---|
BodyPartition |
addBodyPartition(boolean closed,
boolean complete,
long initialSize,
int bodySID,
int indexSID,
UL... containerFormats) |
FooterPartition |
addFooterPartition(boolean complete,
long initialSize,
int indexSID,
UL... containerFormats) |
HeaderPartition |
addHeaderPartition(boolean closed,
boolean complete,
long initialSize,
int bodySID,
int indexSID,
UL... containerFormats) |
boolean |
atEOF()
Determine if the internal file pointer at the end of the file?
|
boolean |
buildPartitionsTable()
Build a partition table from this MXF file containing all the byte offsets
of all the partitions in this MXF file.
|
boolean |
buildRIP() |
MXFFile |
clone()
Returns a cloned copy of the MXF file representation.
|
boolean |
close()
Close this MXF file, preventing further access and releasing any associated
resources.
|
int |
countPartitions()
Count the number of partitions in this file.
|
byte[] |
getDigestValue() |
long |
getFileSize() |
FooterPartition |
getFooterPartition()
Get access to the footer partition of this file.
|
HeaderPartition |
getHeaderPartition()
Get access to the header partition of this file.
|
Partition |
getPartitionAt(int index)
Returns the partition at the given index in the partition table.
|
RandomIndexPack |
getRandomIndexPack()
Returns the random index pack from the end of the file, or
null if the
file does not have a random index pack. |
int |
getRunInSize()
Returns the length of any run in found in the file.
|
boolean |
hasRunIn()
Determines whether this file has an optional run-in.
|
boolean |
isOpen()
Determines if this MXF file is open and therefore and ready to be read and written to.
|
boolean |
lock() |
boolean |
lockForward() |
boolean |
open(String filename,
boolean readOnly)
Open the MXF file with the given name for read-only or read-write as required.
|
boolean |
readRunIn()
Read the internal pointer passed any run-in to the beginning of the
header partition.
|
void |
setFileKAG(int kag) |
void |
setFileMXFByteLevelVersion(short major,
short minor) |
void |
setFileOperationalPattern(UL operationalPattern) |
void |
startDigest(String digestType) |
void |
unlock() |
void |
updatePackSizes() |
boolean |
writeRIP() |
boolean open(String filename, boolean readOnly) throws IOException
Open the MXF file with the given name for read-only or read-write as required.
filename - Name of the file to open.readOnly - Open the file read-only? Set to true for read-only and
false for read-write.IOException - A problem occurred when trying to open the specified file.MXFFactory.readPartitions(String)boolean close()
Close this MXF file, preventing further access and releasing any associated resources. Applications should close MXF files as soon as they are finished reading or writing them.
@UInt32 int getRunInSize()
Returns the length of any run in found in the file. A run-in is optional in an MXF file.
hasRunIn(),
readRunIn()boolean hasRunIn()
Determines whether this file has an optional run-in.
getRunInSize(),
readRunIn()boolean readRunIn()
throws IOException
Read the internal pointer passed any run-in to the beginning of the header partition.
IOException - Problem reading the underlying MXF file.getRunInSize(),
hasRunIn()boolean atEOF()
Determine if the internal file pointer at the end of the file?
boolean buildPartitionsTable()
throws IOException,
EndOfDataException
Build a partition table from this MXF file containing all the byte offsets of all the partitions in this MXF file. It is necessary to call this method before calling any of the other methods that reference partitions.
IOException - Problem occurred when trying to read the file.EndOfDataException - Unexpectedly reached the end of the file, for example
when reading through a partition table.int countPartitions()
Count the number of partitions in this file. A value
of zero may indicate that the partitions table still needs to be built with
buildPartitionsTable().
getPartitionAt(int),
buildPartitionsTable()Partition getPartitionAt(int index) throws IndexOutOfBoundsException
Returns the partition at the given index in the partition table. The partitions are ordered in the sequence they occur in the file, with the partition at index zero being the header partition.
index - Index of the partition table to retrieve.IndexOutOfBoundsException - No parition at the given index, or the partition table
has not yet been built with buildPartitionsTable().buildPartitionsTable()HeaderPartition getHeaderPartition()
Get access to the header partition of this file. Ensure that the partition
table has been built first with buildPartitionsTable().
null if the file is invalid or
the partitions table has not yet been built.getHeaderPartition(),
buildPartitionsTable()FooterPartition getFooterPartition()
Get access to the footer partition of this file. Ensure that the partition
table has been built first with buildPartitionsTable() or a null
may be returned unexpectedly.
null if a footer partition is not
found.getFooterPartition(),
buildPartitionsTable()RandomIndexPack getRandomIndexPack()
Returns the random index pack from the end of the file, or null if the
file does not have a random index pack.
null.boolean isOpen()
Determines if this MXF file is open and therefore and ready to be read and written to.
close()HeaderPartition addHeaderPartition(boolean closed, boolean complete, long initialSize, int bodySID, int indexSID, UL... containerFormats)
BodyPartition addBodyPartition(boolean closed, boolean complete, long initialSize, int bodySID, int indexSID, UL... containerFormats)
FooterPartition addFooterPartition(boolean complete, long initialSize, int indexSID, UL... containerFormats)
void updatePackSizes()
boolean buildRIP()
boolean writeRIP()
throws IOException
IOExceptionvoid setFileOperationalPattern(UL operationalPattern) throws NullPointerException
NullPointerExceptionvoid setFileKAG(@UInt32 int kag) throws IllegalArgumentException
IllegalArgumentExceptionvoid setFileMXFByteLevelVersion(@UInt16 short major, @UInt16 short minor) throws IllegalArgumentException
IllegalArgumentExceptionboolean lock()
boolean lockForward()
void unlock()
void startDigest(String digestType) throws NoSuchAlgorithmException
NoSuchAlgorithmExceptionbyte[] getDigestValue()
long getFileSize()
throws IOException
IOExceptionMXFFile clone()
Returns a cloned copy of the MXF file representation. Note that the MXF file itself is not copied.
(c)2007-2016 Richard Cartwright, all rights reserved. Licensed under Apache 2 license and subject to the AMWA IPR policy.