com.beaglebuddy.mpeg

## Class VBRIHeader

- java.lang.Object
- - com.beaglebuddy.mpeg.VBRIHeader

-     public class VBRIHeader
      extends java.lang.Object

  A VBRI header is found in `variable bit rate` encoded .mp3 files that were encoded using the Fraunhofer encoder. The VBRI header is an optional header, and if present, will be found within the first MPEG audio frame directly following the MPEG side information. It is mutually exclusive with the `Xing` and `LAME` headers. That is, if an Xing or Xing/LAME header is found in the first MPEG audio frame, then a VBRI header can not occur and vice versa. If a VBRI header is found in the first MPEG audio frame, then neither an Xing or LAME header can be present. The format of a variable bit rate encoded .mp3 file is shown below.

  See Also:
    VBRI Header

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `HEADER_MIN_SIZE` VBRI headers are at least 26 bytes long

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `VBRIHeader()` default constructor.
    `VBRIHeader(byte[] bytes, java.io.InputStream inputStream)` constructor.
    `VBRIHeader(byte[] bytes, int index)` constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getDelay()` gets the delay?
    `java.lang.String` | `getId()` gets the VBRI header id which is always "VBRI".
    `int` | `getNumBytes()` gets the number of bytes in the .mp3 file.
    `int` | `getNumFrames()` gets the number of mpeg audio frames in the .mp3 file.
    `int` | `getNumTOCEntries()` gets the number of entries in the table of contents.
    `int` | `getQuality()` gets the quality value, which has a range of [0 - 100], where 0 is the best and 100 is the worst.
    `int` | `getSize()` gets the size (in bytes) of the VBRI header.
    `byte[][]` | `getTableOfContents()` gets the table of contents, which specifies entries used for seeking mpeg audio frames within the .mp3 file.
    `int` | `getTOCEntryNumFrames()` gets the number of frames per entry in the table of contents.
    `int` | `getTOCEntryScaleFactor()` gets the scale factor for the entries in the table of contents.
    `int` | `getTOCEntrySize()` gets the size of each entry in the table of contents.
    `int` | `getVersion()` gets the VBRI header version.
    `java.lang.String` | `toString()`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### HEADER_MIN_SIZE

          public static final int HEADER_MIN_SIZE

      VBRI headers are at least 26 bytes long
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### VBRIHeader

          public VBRIHeader()

      default constructor.

    - #### VBRIHeader

          public VBRIHeader(byte[] bytes,
                    int index)
                     throws ParseException

      constructor.
      Parameters:
        `bytes` - the raw bytes of an MPEG audio frame.
        `index` - the offset into the bytes of the MPEG audio frame where the VBRI header begins.
      Throws:
        `ParseException` - if an invalid value is detected while parsing the VBRI header's raw bytes.

    - #### VBRIHeader

          public VBRIHeader(byte[] bytes,
                    java.io.InputStream inputStream)
                     throws java.io.IOException,
                            ParseException

      constructor.
      Parameters:
        `bytes` - bytes read in from the previous attempt to find the Xing header.
        `inputStream` - input stream pointing to the VBRI header in an mpeg audio frame in an .mp3 file.
      Throws:
        `java.io.IOException` - if there is an error while reading the VBRI header from the .mp3 file.
        `ParseException` - if an invalid value is detected while parsing the VBRI header's raw bytes.

  - ### Method Detail

    - #### getSize

          public int getSize()

      gets the size (in bytes) of the VBRI header.
      Returns:
        the size (in bytes) of the VBRI header.

    - #### getId

          public java.lang.String getId()

      gets the VBRI header id which is always "VBRI".
      Returns:
        the VBRI header id.

    - #### getVersion

          public int getVersion()

      gets the VBRI header version.
      Returns:
        the VBRI header version.

    - #### getDelay

          public int getDelay()

      gets the delay?
      Returns:
        the delay of the mpeg audio frame.

    - #### getQuality

          public int getQuality()

      gets the quality value, which has a range of [0 - 100], where 0 is the best and 100 is the worst.
      Returns:
        the quality of the mpeg audio frame.

    - #### getNumBytes

          public int getNumBytes()

      gets the number of bytes in the .mp3 file.
      Returns:
        the number of bytes in the .mp3 file.

    - #### getNumFrames

          public int getNumFrames()

      gets the number of mpeg audio frames in the .mp3 file.
      Returns:
        the number of mpeg audio frames in the .mp3 file.

    - #### getNumTOCEntries

          public int getNumTOCEntries()

      gets the number of entries in the table of contents.
      Returns:
        the number of entries in the table of contents.

    - #### getTOCEntryScaleFactor

          public int getTOCEntryScaleFactor()

      gets the scale factor for the entries in the table of contents.
      Returns:
        the scale factor for the entries in the table of contents.

    - #### getTOCEntrySize

          public int getTOCEntrySize()

      gets the size of each entry in the table of contents.
      Returns:
        the size of each entry in the table of contents.

    - #### getTOCEntryNumFrames

          public int getTOCEntryNumFrames()

      gets the number of frames per entry in the table of contents.
      Returns:
        the number of frames per entry in the table of contents.

    - #### getTableOfContents

          public byte[][] getTableOfContents()

      gets the table of contents, which specifies entries used for seeking mpeg audio frames within the .mp3 file.
      Returns:
        the table of contents used for seeking mpeg audio frames within the .mp3 file.

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        a string representation of the VBRI header.