com.beaglebuddy.id3.v24.frame_body

## Class ID3v24FrameBodyComments

- 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.ID3v24FrameBodyComments

-     public class ID3v24FrameBodyComments
      extends ID3v24FrameBody

  A comments frame body is associated with an ID3v2.4 `COMM` `frame` which is intended for any kind of full text information that does not fit in any other frame. The comments frame body contains the following fields:

  Comments Frame Body Fields
  | Field | Description
  --- | --- | ---
  1. | `encoding` | character set used to `encode` the description and text fields.
  2. | `language` | `language` the comments are written in.
  3. | description | short description of the comments. This field is optional and be left empty ("").
  4. | text | actual comments about the .mp3 file.

  There may be more than one comment frame in an ID3v2.4 `tag`, but only one with the same language and description fields.

  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
    `ID3v24FrameBodyComments()` The default constructor is called when creating a new frame.
    `ID3v24FrameBodyComments(Encoding encoding, Language language, java.lang.String description, java.lang.String text)` This constructor is called when creating a new frame.
    `ID3v24FrameBodyComments(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
    --- | ---
    `java.lang.String` | `getDescription()` gets the description.
    `Encoding` | `getEncoding()` gets the character encoding of the description and text fields.
    `Language` | `getLanguage()` gets the `language` the comments are written in.
    `java.lang.String` | `getText()` get the actual comment(s) about the .mp3 file.
    `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` | `setDescription(java.lang.String description)` sets the description.
    `void` | `setEncoding(Encoding encoding)` sets the character encoding of the description and text fields.
    `void` | `setLanguage(Language language)` sets the `language` the comments are written in.
    `void` | `setText(java.lang.String text)` sets the actual comment(s) about the .mp3 file.
    `java.lang.String` | `toString()` gets a string representation of the comments 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, pad, shortToBytes, synchsafeIntToBytes`

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

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

- - ### Constructor Detail

    - #### ID3v24FrameBodyComments

          public ID3v24FrameBodyComments()

      The default constructor is called when creating a new frame. The default values used are:
      - ISO-8859-1 encoding
      - english language
      - empty description
      - empty comments

    - #### ID3v24FrameBodyComments

          public ID3v24FrameBodyComments(Encoding encoding,
                                 Language language,
                                 java.lang.String description,
                                 java.lang.String text)

      This constructor is called when creating a new frame.
      Parameters:
        `encoding` - character set used to encode the description field.
        `language` - ISO-639-2 language code indicating the language the comments were written in.
        `description` - short description of the comment.
        `text` - actual comment text.

    - #### ID3v24FrameBodyComments

          public ID3v24FrameBodyComments(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 comments 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.

    - #### getEncoding

          public Encoding getEncoding()

      gets the character encoding of the description and text fields.
      Returns:
        the character encoding of the description and text fields.
      See Also:
        `setEncoding(Encoding)`

    - #### setEncoding

          public void setEncoding(Encoding encoding)

      sets the character encoding of the description and text fields.
      Parameters:
        `encoding` - the character set used to encode the description and text fields. Only ISO 8859-1 and UTF-16 are allowed.
      See Also:
        `getEncoding()`

    - #### getLanguage

          public Language getLanguage()

      gets the `language` the comments are written in.
      Returns:
        the language the comments are written in.
      See Also:
        `setLanguage(Language)`

    - #### setLanguage

          public void setLanguage(Language language)

      sets the `language` the comments are written in.
      Parameters:
        `language` - `language` the comments are written in.
      See Also:
        `getLanguage()`

    - #### getDescription

          public java.lang.String getDescription()

      gets the description.
      Returns:
        the description.
      See Also:
        `setDescription(String)`

    - #### setDescription

          public void setDescription(java.lang.String description)

      sets the description.
      Parameters:
        `description` - the description of the content.
      See Also:
        `getDescription()`

    - #### getText

          public java.lang.String getText()

      get the actual comment(s) about the .mp3 file.
      Returns:
        the comment(s) about the .mp3 file.
      See Also:
        `setText(String)`

    - #### setText

          public void setText(java.lang.String text)

      sets the actual comment(s) about the .mp3 file.
      Parameters:
        `text` - comment(s) about the .mp3 file.
      See Also:
        `getText()`

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