com.beaglebuddy.mpeg

## Class MPEGSideInformation

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

-     public class MPEGSideInformation
      extends java.lang.Object

  The MPEG side information follows the MPEG audio frame header in an MPEG audio frame. It is a required part of an MPEG audio frame, and is used by mp3 players to decode the mpeg audio samples.

  See Also:
    `MPEGFrame`, Section 5.2, page 24 of "MP3 Decoder in Theory and Practice", Section 5.1.2, page 13 of "The Theory Behind Mp3"

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `HEADER_MAX_SIZE` side information is 32 bytes long for .mp3 files encoded with dual channels (stereo).
    `static int` | `HEADER_MIN_SIZE` side information is 17 bytes long for .mp3 files encoded with a single channel (mono).

  - ### Constructor Summary

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

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `getData()` gets the raw binary data stored in the side information block in an mpeg audio frame.
    `int` | `getSize()` gets the size (in bytes) of the side information block in an mpeg audio frame.
    `java.lang.String` | `toString()` gets a string representation of the mpeg audio frame's side information.

    - ### 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

      side information is 17 bytes long for .mp3 files encoded with a single channel (mono).
      See Also:
        Constant Field Values

    - #### HEADER_MAX_SIZE

          public static final int HEADER_MAX_SIZE

      side information is 32 bytes long for .mp3 files encoded with dual channels (stereo).
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### MPEGSideInformation

          public MPEGSideInformation()

      default constructor.

    - #### MPEGSideInformation

          public MPEGSideInformation(byte[] bytes,
                             int size)
                              throws ParseException

      constructor.
      Parameters:
        `bytes` - the raw bytes of an MPEG audio frame.
        `size` - size (in bytes) of the side information block in the mpeg audio frame.
      Throws:
        `ParseException` - if an invalid size is specified, or if the byte stream is smaller than the specified size.

    - #### MPEGSideInformation

          public MPEGSideInformation(java.io.InputStream inputStream,
                             int size)
                              throws java.io.IOException,
                                     ParseException

      constructor.
      Parameters:
        `inputStream` - input stream pointing to the side information data in an mpeg audio frame in an .mp3 file.
        `size` - size (in bytes) of the side information block in the mpeg audio frame.
      Throws:
        `java.io.IOException` - if there is an error while reading the side information from the .mp3 file.
        `ParseException` - if an invalid size is specified, or if the byte stream is smaller than the specified size.

  - ### Method Detail

    - #### getData

          public byte[] getData()

      gets the raw binary data stored in the side information block in an mpeg audio frame.
      Returns:
        the raw binary data stored in the side information block in an mpeg audio frame.

    - #### getSize

          public int getSize()

      gets the size (in bytes) of the side information block in an mpeg audio frame.
      Returns:
        the size (in bytes) of the side information block in an mpeg audio frame.

    - #### toString

          public java.lang.String toString()

      gets a string representation of the mpeg audio frame's side information.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        a string representation of the mpeg audio frame's side information.