Class MpegReader


  • public class MpegReader
    extends java.lang.Object
    Handles reading parts of an MP4 file
    • Field Detail

      • data

        public final java.io.DataInput data
        The input as a DataInput
    • Constructor Detail

      • MpegReader

        public MpegReader​(SeekableInputStream inputStream)
        Parameters:
        inputStream - Input as a seekable stream
    • Method Detail

      • nextChild

        public MpegSectionInfo nextChild​(MpegSectionInfo parent)
                                  throws java.io.IOException
        Reads the header of the next child element. Assumes position is at the start of a header or at the end of the section.
        Parameters:
        parent - The section from which to read child sections from
        Returns:
        The element if there were any more child elements
        Throws:
        java.io.IOException - When network exception is happened
      • skip

        public void skip​(MpegSectionInfo section)
        Skip to the end of a section.
        Parameters:
        section - The section to skip
      • readFourCC

        public java.lang.String readFourCC()
                                    throws java.io.IOException
        Read a FourCC as a string
        Returns:
        The FourCC string
        Throws:
        java.io.IOException - When reading the bytes from input fails
      • readUtfString

        public java.lang.String readUtfString​(int size)
                                       throws java.io.IOException
        Read an UTF string with a specified size.
        Parameters:
        size - Size in bytes.
        Returns:
        The string read from the stream
        Throws:
        java.io.IOException - On read error
      • readTerminatedString

        public java.lang.String readTerminatedString()
                                              throws java.io.IOException
        Read a null-terminated UTF string.
        Returns:
        The string read from the stream
        Throws:
        java.io.IOException - On read error
      • readCompressedInt

        public int readCompressedInt()
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • parseFlags

        public MpegVersionedSectionInfo parseFlags​(MpegSectionInfo section)
                                            throws java.io.IOException
        Parse the flags and version for the specified section
        Parameters:
        section - The section where the flags and version should be parsed
        Returns:
        The section info with version info
        Throws:
        java.io.IOException - On a read error
      • in

        public MpegReader.Chain in​(MpegSectionInfo parent)
        Start a child element handling chain
        Parameters:
        parent - The parent chain
        Returns:
        The chain