com.beaglebuddy.id3.v24.frame_body

## Class ID3v24FrameBodyMusicCDIdentifier

- java.lang.Object
- - com.beaglebuddy.util.Utility
  - - com.beaglebuddy.id3.v24.frame_body.ID3v24FrameBodyUtility
    - - com.beaglebuddy.id3.v24.frame_body.ID3v24FrameBody
      - - com.beaglebuddy.id3.v24.frame_body.ID3v24FrameBodyMusicCDIdentifier

-     public class ID3v24FrameBodyMusicCDIdentifier
      extends ID3v24FrameBody

  A music CD identifier frame body is associated with an ID3v2.4 `MCDI` `frame` which is used to identify .mp3 songs that are ripped from a CD, so that they can be identified in a database, such as CDDB. The frame body consists of a binary dump of the CD's Table Of Contents (TOC) which is a header of 4 bytes and then 8 bytes/track on the CD plus 8 bytes for the 'lead out' making a maximum of 804 bytes. The offset to the beginning of every track on the CD should be described with a four byte absolute CD-frame address per track, and not with absolute time. This frame requires a present and valid `Track` frame, even if the CD's only got one track. The music CD identifier frame body contains the following fields:

  Music CD Identifier Frame Body Fields
  | Field | Description
  --- | --- | ---
  1. | cdTOC | raw binary data of the CD's table of contents from which the .mp3 file was ripped.

  There may only be one music CD identifier frame in each tag.

  See Also:
    `ID3v24Frame`, ID3 tag version 2.4.0 standard, wikipedia history of ID3 tags

- - ### Field Summary

    - ### Fields inherited from class com.beaglebuddy.id3.v24.frame_body.ID3v24FrameBody

      `buffer, dirty, frameType`

    - ### Fields inherited from class com.beaglebuddy.id3.v24.frame_body.ID3v24FrameBodyUtility

      `nextNullTerminatorIndex, nullTerminatorIndex`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ID3v24FrameBodyMusicCDIdentifier()` The default constructor is called when creating a new frame.
    `ID3v24FrameBodyMusicCDIdentifier(byte[] cdTOC)` This constructor is called when creating a new frame.
    `ID3v24FrameBodyMusicCDIdentifier(java.io.InputStream inputStream, int frameBodySize)` This constructor is called when reading in an existing frame from an .mp3 file.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `getCdTOC()` gets the raw binary data of the cd's table of contents from which this .mp3 was ripped.
    `void` | `parse()` parses the raw bytes of the frame body and stores the parsed values in the frame's fields.
    `void` | `setBuffer()` If the frame body's values have been modified, then resize the raw binary buffer and store the new values there.
    `void` | `setCdTOC(byte[] cdTOC)` sets the raw binary data of the cd's table of contents from which this .mp3 was ripped.
    `java.lang.String` | `toString()` gets a string representation of the music CD identifier frame body showing all of the frame's fields and their values.

    - ### Methods inherited from class com.beaglebuddy.id3.v24.frame_body.ID3v24FrameBody

      `getFrameType, getNextNullTerminator, getSize, isDirty, save, save`

    - ### Methods inherited from class com.beaglebuddy.id3.v24.frame_body.ID3v24FrameBodyUtility

      `getNextNullTerminator, pricesToString, stringToBytes`

    - ### Methods inherited from class com.beaglebuddy.util.Utility

      `bytesToInt, bytesToInt, bytesToShort, bytesToShort, bytesToSynchsafeInt, bytesToSynchsafeShort, formateDate, hex, hex, hex, intToBytes, littleEndianBytesToInt, pad, shortToBytes, synchsafeIntToBytes`

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

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

- - ### Constructor Detail

    - #### ID3v24FrameBodyMusicCDIdentifier

          public ID3v24FrameBodyMusicCDIdentifier()

      The default constructor is called when creating a new frame. The default values used are:
      - empty CD TOC (byte array of length 0)

    - #### ID3v24FrameBodyMusicCDIdentifier

          public ID3v24FrameBodyMusicCDIdentifier(byte[] cdTOC)

      This constructor is called when creating a new frame.
      Parameters:
        `cdTOC` - raw binary data of the cd's table of contents from which this .mp3 was ripped.

    - #### ID3v24FrameBodyMusicCDIdentifier

          public ID3v24FrameBodyMusicCDIdentifier(java.io.InputStream inputStream,
                                          int frameBodySize)
                                           throws java.io.IOException

      This constructor is called when reading in an existing frame from an .mp3 file. This is then followed by a call to the parse() method.
      Parameters:
        `inputStream` - input stream pointing to a music cd identifier frame body in the .mp3 file.
        `frameBodySize` - size (in bytes) of the frame's body.
      Throws:
        `java.io.IOException` - if there is an error while reading the frame body.

  - ### Method Detail

    - #### parse

          public void parse()
                     throws java.lang.IllegalArgumentException

      parses the raw bytes of the frame body and stores the parsed values in the frame's fields.
      Overrides:
        `parse` in class `ID3v24FrameBody`
      Throws:
        `java.lang.IllegalArgumentException` - if an invalid value is detected while parsing the frame body's raw bytes.

    - #### getCdTOC

          public byte[] getCdTOC()

      gets the raw binary data of the cd's table of contents from which this .mp3 was ripped.
      Returns:
        the raw binary data of the cd's table of contents from which this .mp3 was ripped.
      See Also:
        `setCdTOC(byte[])`

    - #### setCdTOC

          public void setCdTOC(byte[] cdTOC)

      sets the raw binary data of the cd's table of contents from which this .mp3 was ripped.
      Parameters:
        `cdTOC` - the binary data of the cd table of contents.
      See Also:
        `getCdTOC()`

    - #### setBuffer

          public void setBuffer()

      If the frame body's values have been modified, then resize the raw binary buffer and store the new values there. When finished, the dirty flag is reset to indicate that the buffer is up to date, and the frame is now ready to be saved to the .mp3 file.
      Overrides:
        `setBuffer` in class `ID3v24FrameBody`

    - #### toString

          public java.lang.String toString()

      gets a string representation of the music CD identifier frame body showing all of the frame's fields and their values.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        a string representation of the frame body.