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

tv.amwa.maj.io.mxf

## Class MXFStream

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

-     public class MXFStream
      extends Object

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `MXFStream.KeyAndConsumed`
    `static class` | `MXFStream.LengthAndConsumed`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MXFStream()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static MXFStream.LengthAndConsumed` | `readBERLength(InputStream stream)`
    `static CPSystemItem` | `readCPSystemItem(InputStream stream)`
    `static EssenceElement` | `readEssenceElement(InputStream stream)`
    `static int` | `readEssenceElementWithBytesRead(InputStream stream, byte[] elementData)`
    `static int` | `readEssenceElementWithTrackID(InputStream stream, byte[] elementData)`
    `static HeaderMetadata` | `readFooterHeaderMetadata(InputStream inputStream, int pag)`
    `static HeaderMetadata` | `readFooterHeaderMetadata(InputStream inputStream, long footerPartitionOffset)`
    `static HeaderMetadata` | `readHeaderMetadata(InputStream stream, long headerSize)`
    `static IndexTableSegment` | `readIndexTableSegment(InputStream stream)`
    `static MXFStream.KeyAndConsumed` | `readKey(InputStream stream)`
    `static MXFUnit` | `readNextUnit(InputStream stream, long sizeLimit)`
    `static PartitionPack` | `readPartitionPack(InputStream stream)`
    `static long` | `readPastFill(InputStream stream)`
    `static RandomIndexPack` | `readRandomIndexPack(InputStream stream)`
    `static RandomIndexPack` | `readRandomIndexPack(InputStream stream, long size)` Read a random index pack (RIP) from the given input stream, using the given size to efficiently skip to the end of the file to find the RIP.
    `static UL` | `readSingleKey(InputStream stream)`
    `static ByteBuffer` | `readValue(InputStream stream, long size)`
    `static long` | `skipForward(InputStream sourceStream, long bytesToSkip)`
    `static void` | `writeBERLength(OutputStream stream, long length, int encodedBytes)`
    `static void` | `writeEssenceElement(OutputStream stream, int essenceTrackID, byte[] elementData)`
    `static void` | `writeEssenceElement(OutputStream stream, int essenceTrackID, byte[] elementData, int offset, int length)`
    `static void` | `writeFill(OutputStream stream, long totalLength)`
    `static void` | `writeHeaderMetadata(OutputStream stream, Preface preface)`
    `static void` | `writeIndexTableSegment(OutputStream stream, IndexTableSegment indexTableSegment)`
    `static void` | `writeKey(OutputStream stream, UL key)`
    `static void` | `writePartitionPack(OutputStream stream, PartitionPack pack)`
    `static void` | `writeRandomIndexPack(OutputStream stream, RandomIndexPack rip)`
    `static void` | `writeValue(OutputStream stream, ByteBuffer buffer)`

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

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

- - ### Constructor Detail

    - #### MXFStream

          public MXFStream()

  - ### Method Detail

    - #### readNextUnit

          public static final MXFUnit readNextUnit(InputStream stream,
                                                   long sizeLimit)
                                            throws IOException

      Throws:
        `IOException`

    - #### readRandomIndexPack

          public static final RandomIndexPack readRandomIndexPack(InputStream stream,
                                                                  long size)
                                                           throws IOException

      Read a random index pack (RIP) from the given input stream, using the given size to efficiently skip to the end of the file to find the RIP. As the RIP is always located at the end of the file, the input stream is always closed following this operation.

      Parameters:
        `stream` - Stream of MXF data to read and retrieve the RIP from.
        `size` - Total size of the input stream measured in bytes, which must be known in advance of a call to this method.
      Returns:
        Random index pack contained in the given input stream.
      Throws:
        `IOException` - Problem occurred when reading the file or no RIP is contained within the file.

    - #### readHeaderMetadata

          public static final HeaderMetadata readHeaderMetadata(InputStream stream,
                                                                long headerSize)
                                                         throws IOException

      Throws:
        `IOException`

    - #### readPartitionPack

          public static final PartitionPack readPartitionPack(InputStream stream)
                                                       throws IOException

      Throws:
        `IOException`

    - #### readEssenceElement

          public static final EssenceElement readEssenceElement(InputStream stream)
                                                         throws IOException

      Throws:
        `IOException`

    - #### readEssenceElementWithTrackID

          public static final int readEssenceElementWithTrackID(InputStream stream,
                                                                byte[] elementData)
                                                         throws IOException

      Throws:
        `IOException`

    - #### readEssenceElementWithBytesRead

          public static final int readEssenceElementWithBytesRead(InputStream stream,
                                                                  byte[] elementData)
                                                           throws IOException

      Throws:
        `IOException`

    - #### writeEssenceElement

          public static final void writeEssenceElement(OutputStream stream,
                                                       int essenceTrackID,
                                                       byte[] elementData)
                                                throws IOException

      Throws:
        `IOException`

    - #### writeEssenceElement

          public static final void writeEssenceElement(OutputStream stream,
                                                       int essenceTrackID,
                                                       byte[] elementData,
                                                       int offset,
                                                       int length)
                                                throws IOException

      Throws:
        `IOException`

    - #### readCPSystemItem

          public static final CPSystemItem readCPSystemItem(InputStream stream)
                                                     throws IOException

      Throws:
        `IOException`

    - #### readIndexTableSegment

          public static final IndexTableSegment readIndexTableSegment(InputStream stream)
                                                               throws IOException

      Throws:
        `IOException`

    - #### readRandomIndexPack

          public static final RandomIndexPack readRandomIndexPack(InputStream stream)
                                                           throws IOException

      Throws:
        `IOException`

    - #### readFooterHeaderMetadata

          public static final HeaderMetadata readFooterHeaderMetadata(InputStream inputStream,
                                                                      int pag)
                                                               throws IOException

      Throws:
        `IOException`

    - #### readFooterHeaderMetadata

          public static final HeaderMetadata readFooterHeaderMetadata(InputStream inputStream,
                                                                      long footerPartitionOffset)
                                                               throws IOException

      Throws:
        `IOException`

    - #### writePartitionPack

          public static final void writePartitionPack(OutputStream stream,
                                                      PartitionPack pack)
                                               throws IOException

      Throws:
        `IOException`

    - #### writeHeaderMetadata

          public static final void writeHeaderMetadata(OutputStream stream,
                                                       Preface preface)
                                                throws IOException

      Throws:
        `IOException`

    - #### writeIndexTableSegment

          public static final void writeIndexTableSegment(OutputStream stream,
                                                          IndexTableSegment indexTableSegment)
                                                   throws IOException

      Throws:
        `IOException`

    - #### writeRandomIndexPack

          public static final void writeRandomIndexPack(OutputStream stream,
                                                        RandomIndexPack rip)
                                                 throws IOException

      Throws:
        `IOException`

    - #### readKey

          public static final MXFStream.KeyAndConsumed readKey(InputStream stream)
                                                        throws IOException

      Throws:
        `IOException`

    - #### readSingleKey

          public static final UL readSingleKey(InputStream stream)
                                        throws IOException

      Throws:
        `IOException`

    - #### readBERLength

          public static final MXFStream.LengthAndConsumed readBERLength(InputStream stream)
                                                                 throws IOException

      Throws:
        `IOException`

    - #### readValue

          public static final ByteBuffer readValue(InputStream stream,
                                                   long size)
                                            throws IOException

      Throws:
        `IOException`

    - #### writeKey

          public static final void writeKey(OutputStream stream,
                                            UL key)
                                     throws IOException

      Throws:
        `IOException`

    - #### writeBERLength

          public static final void writeBERLength(OutputStream stream,
                                                  long length,
                                                  int encodedBytes)
                                           throws IOException

      Throws:
        `IOException`

    - #### writeValue

          public static final void writeValue(OutputStream stream,
                                              ByteBuffer buffer)
                                       throws IOException

      Throws:
        `IOException`

    - #### writeFill

          public static final void writeFill(OutputStream stream,
                                             long totalLength)
                                      throws IOException

      Throws:
        `IOException`

    - #### readPastFill

          public static final long readPastFill(InputStream stream)
                                         throws IOException

      Throws:
        `IOException`

    - #### skipForward

          public static final long skipForward(InputStream sourceStream,
                                               long bytesToSkip)
                                        throws IOException

      Throws:
        `IOException`

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