com.beaglebuddy.id3.v24.frame_body

## Class ID3v24FrameBodyTextInformation

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

-     public class ID3v24FrameBodyTextInformation
      extends ID3v24FrameBody

  A text information frame body is associated with the ID3v2.4 `frames` listed below, and are the most important frames, containing information like artist, album, song title, and more. The ID3v2.4 specification defines 45 types of text frames. The text information frame body contains the following fields:

  Text Information Frame Body Fields
  | Field | Description
  --- | --- | ---
  1. | `encoding` | character set used to `encode` the text field.
  2. | text | a string whose value depends on the type of text frame. see the list below. All text information frames supports multiple strings, stored as a null separated list, where null is represented by the termination code for the character encoding.

  Text Information Frames
  Frame Id | Description
  --- | ---
  TALB | The 'Album/Movie/Show title' frame is intended for the title of the recording(/source of sound) which the audio in the file is taken from.
  TBPM | The 'BPM' frame contains the number of beats per minute in the main part of the audio. The BPM is an integer and represented as a numerical string.
  TCOM | The 'Composer(s)' frame is intended for the name of the composer(s). They are separated with the "/" character.
  TCON | The 'Content type', which ID3v1 was stored as a one byte numeric value only, is now a string. You may use one or several of the ID3v1 types as numerical strings, or, since the category list would be impossible to maintain with accurate and up to date categories, define your own. References to the ID3v1 genres can be made by enclosing a number from the `genres list` with parentheses. This is optionally followed by a refinement, e.g. "(21)" or "(4)Eurodisco". Several references can be made in the same frame, e.g. "(51)(39)". If the refinement should begin with a parenthesis, "(", it should be replaced with "((", e.g. "((I can figure out any genre)" or "(55)((I think...)".
  TCOP | The 'Copyright message' frame, which must begin with a year and a space character (making five characters), is intended for the copyright holder of the original sound, not the audio file itself. The absence of this frame means only that the copyright information is unavailable or has been removed, and must not be interpreted to mean that the sound is public domain. Every time this field is displayed the field must be preceded with "Copyright © ".
  TDEN | The 'Encoding time' frame contains a `Timestamp` describing when the audio was encoded. ie, when the .mp3 was created.
  TDLY | The 'Playlist delay' defines the numbers of milliseconds of silence that should be inserted before this audio. The value zero indicates that this is a part of a multifile audio track that should be played continuously.
  TDOR | The 'Original Release time' frame contains a `Timestamp` when the original recording of the audio was released.
  TDRC | The 'Recording time' frame contains a `Timestamp` describing when the audio was encoded.
  TDRL | The 'Release time' frame contains a `Timestamp` describing when the audio was first released.
  TDTG | The 'Tagging time' frame contains a `Timestamp` describing when the audio was tagged.
  TENC | The 'Encoded by' frame contains the name of the person or organization that encoded the audio file. This field may contain a copyright message, if the audio file also is copyrighted by the encoder.
  TEXT | The 'Lyricist(s)/Text writer(s)' frame is intended for the writer(s) of the text or lyrics in the recording. They are separated with the "/" character.
  TFLT | The 'File type' frame indicates which type of audio this tag defines. The following type and refinements are defined:
  Type | Refinement
  --- | ---
  MPG | MPEG Audio
  MPG/1 | MPEG 1/2 layer I
  MPG/2 | MPEG 1/2 layer II
  MPG/3 | MPEG 1/2 layer III
  MPG/2.5 | MPEG 2.5
  MPG/AAC | Advanced audio compression
  VQF | Transform-domain Weighted Interleave Vector Quantization
  PCM | Pulse Code Modulated audio
  but other types may be used, not for these types though. This is used in a similar way to the predefined types in the "TMED" frame, but without parentheses. If this frame is not present audio type is assumed to be "MPG".
  TIPL | The 'Involved people list' frame is very similar to the musician credits list (TMCL), but maps between functions, like producer, and names. Use the `getTextList()` method to retrieve the list.
  TIT1 | The 'Content group description' frame is used if the sound belongs to a larger category of sounds/music. For example, classical music is often sorted in different musical sections (e.g. "Piano Concerto", "Weather - Hurricane").
  TIT2 | The 'Title/Songname/Content description' frame is the actual name of the piece (e.g. "Adagio", "Hurricane Donna").
  TIT3 | The 'Subtitle/Description refinement' frame is used for information directly related to the contents title (e.g. "Op. 16" or "Performed live at Wembley").
  TKEY | The 'Initial key' frame contains the musical key in which the sound starts. It is represented as a string with a maximum length of three characters. The ground keys are represented with "A","B","C","D","E", "F" and "G" and halfkeys represented with "b" and "#". Minor is represented as "m". Example "Cbm". Off key is represented with an "o" only.
  TLAN | The 'Language(s)' frame should contain the languages of the text or lyrics spoken or sung in the audio. The `language` is represented with three characters according to the ISO-639-2 specification. If more than one language is used in the text their language codes should follow according to their usage.
  TLEN | The 'Length' frame contains the length of the audiofile in milliseconds, represented as a numeric string.
  TMCL | The 'Musician credits list' frame contains a mapping between instruments and the musician that played it. Every odd field is an instrument and every even is an artist or a comma delimited list of artists. Use the `getTextList()` method to retrieve the list.
  TMED | The 'Media type' frame describes from which media the sound originated. This may be a text string or a reference to the predefined media types found in the list below. References are made within "(" and ")" and are optionally followed by a text refinement, e.g. "(MC) with four channels". If a text refinement should begin with a "(" character it should be replaced with "((" in the same way as in the "TCO" frame. Predefined refinements is appended after the media type, e.g. "(CD/A)" or "(VID/PAL/VHS)".
  Type | Refinement | Description
  --- | --- | ---
  DIG |  | Other digital media
  DIG | /A | Analog transfer from media
  ANA |  | Other analog media
  ANA | /WAC | Wax cylinder
  ANA | /8CA | 8-track tape cassette
  CD |  | CD
  CD | /A | Analog transfer from media
  CD | /DD | DDD
  CD | /AD | ADD
  CD | /AA | AAD
  LD |  | Laserdisc
  LD | /A | Analog transfer from media
  TT |  | Turntable records
  TT | /33 | 33.33 rpm
  TT | /45 | 45 rpm
  TT | /71 | 71.29 rpm
  TT | /76 | 76.59 rpm
  TT | /78 | 78.26 rpm
  TT | /80 | 80 rpm
  MD |  | MiniDisc
  MD | /A | Analog transfer from media
  DAT |  | DAT
  DAT | /A | Analog transfer from media
  DAT | /1 | standard, 48 kHz/16 bits, linear
  DAT | /2 | mode 2, 32 kHz/16 bits, linear
  DAT | /3 | mode 3, 32 kHz/12 bits, nonlinear, low speed
  DAT | /4 | mode 4, 32 kHz/12 bits, 4 channels
  DAT | /5 | mode 5, 44.1 kHz/16 bits, linear
  DAT | /6 | mode 6, 44.1 kHz/16 bits, 'wide track' play
  DCC |  | DCC
  DCC | /A | Analog transfer from media
  DVD |  | DVD
  DVD | /A | Analog transfer from media
  TV |  | Television
  TV | /PAL | PAL
  TV | /NTSC | NTSC
  TV | /SECAM | SECAM
  VID |  | Video
  VID | /PAL | PAL
  VID | /NTSC | NTSC
  VID | /SECAM | SECAM
  VID | /VHS | VHS
  VID | /SVHS | S-VHS
  VID | /BETA | BETAMAX
  RAD |  | Radio
  RAD | /FM | FM
  RAD | /AM | AM
  RAD | /LW | LW
  RAD | /MW | MW
  TEL |  | Telephone
  TEL | /I | ISDN
  MC |  | MC (normal cassette)
  MC | /4 | 4.75 cm/s (normal speed for a two sided cassette)
  MC | /9 | 9.5 cm/s
  MC | /I | Type I cassette (ferric/normal)
  MC | /II | Type II cassette (chrome)
  MC | /III | Type III cassette (ferric chrome)
  MC | /IV | Type IV cassette (metal)
  REE |  | Reel
  REE | /9 | 9.5 cm/s
  REE | /19 | 19 cm/s
  REE | /38 | 38 cm/s
  REE | /76 | 76 cm/s
  REE | /I | Type I cassette (ferric/normal)
  REE | /II | Type II cassette (chrome)
  REE | /III | Type III cassette (ferric chrome)
  REE | /IV | Type IV cassette (metal)
  TMOO | The 'Mood' frame is to reflect the mood of the audio with a few keywords, e.g. "Romantic" or "Sad".
  TOAL | The 'Original album/movie/show title' frame is intended for the title of the original recording (or source of sound), if for example the music in the file should be a cover of a previously released song.
  TOFN | The 'Original filename' frame contains the preferred filename for the file, since some media doesn't allow the desired length of the filename. The filename is case sensitive and includes its suffix.
  TOLY | The 'Original lyricist(s)/text writer(s)' frame is intended for the text writer(s) of the original recording, if for example the music in the file should be a cover of a previously released song. The text writers are seperated with the "/" character.
  TOPE | The 'Original artist(s)/performer(s)' frame is intended for the performer(s) of the original recording, if for example the music in the file should be a cover of a previously released song. The performers are seperated with the "/" character.
  TOWN | The 'File owner/licensee' frame contains the name of the owner or licensee of the file and it's contents.
  TPE1 | The 'Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group' is used for the main artist(s). They are separated with the "/" character.
  TPE2 | The 'Band/Orchestra/Accompaniment' frame is used for additional information about the performers in the recording.
  TPE3 | The 'Conductor' frame is used for the name of the conductor.
  TPE4 | The 'Interpreted, remixed, or otherwise modified by' frame contains more information about the people behind a remix and similar interpretations of another existing piece.
  TPOS | The 'Part of a set' frame is a numeric string that describes which part of a set the audio came from. This frame is used if the source described in the "TALB" frame is divided into several mediums, e.g. a double CD. The value may be extended with a "/" character and a numeric string containing the total number of parts in the set. E.g. "1/2".
  TPRO | The 'Produced notice' frame is intended for the production copyright holder of the original sound, not the audio file itself. The absence of this frame means only that the production copyright information is unavailable or has been removed, and must not be interpreted to mean that the audio is public domain. The text must begin with a year followed by a space character (making five characters). Every time this field is displayed the field must be preceded with "Produced " (P) " ", where (P) is one character showing a P in a circle.
  TPUB | The 'Publisher' frame simply contains the name of the label or publisher.
  TRCK | The 'Track number/Position in set' frame is a numeric string containing the order number of the audio-file on its original recording. This may be extended with a "/" character and a numeric string containing the total numer of tracks/elements on the original recording. E.g. "4/9".
  TRSN | The 'Internet radio station name' frame contains the name of the internet radio station from which the audio is streamed.
  TRSO | The 'Internet radio station owner' frame contains the name of the owner of the internet radio station from which the audio is streamed.
  TSOA | The 'Album sort order' frame is a intended to be used to define the name to be used to sort this mp3 song instead of the album name (TALB). E.g. an album named "A Soundtrack" might preferably be sorted as "Soundtrack".
  TSOP | The 'Performer sort order' frame defines a string which should be used instead of the performer (TPE2) for sorting purposes.
  TSOT | The 'Title sort order' frame defines a string which should be used instead of the title (TIT2) for sorting purposes.
  TSRC | The 'ISRC' frame should contain the International Standard Recording Code (ISRC) (12 characters).
  TSSE | The 'Software/Hardware and settings used for encoding' frame includes the used audio encoder and its settings when the file was encoded. Hardware refers to hardware encoders, not the computer on which a program was run.

  There may only be one text information frame of its kind in an ID3v2.4 `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
    `ID3v24FrameBodyTextInformation(FrameType frameType)` The constructor is called when creating a new frame.
    `ID3v24FrameBodyTextInformation(FrameType frameType, Encoding encoding, java.lang.String text)` This constructor is called when creating a new frame.
    `ID3v24FrameBodyTextInformation(java.io.InputStream inputStream, FrameType frameType, 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
    --- | ---
    `Encoding` | `getEncoding()` gets the character encoding of the text.
    `java.lang.String` | `getText()` gets the text.
    `java.util.List<java.lang.String>` | `getTextList()` gets the text as a list.
    `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` | `setEncoding(Encoding encoding)` sets the character encoding of the text.
    `void` | `setText(java.lang.String text)` sets the text.
    `void` | `setTextList(java.util.List<java.lang.String> textList)` sets the text from the list of strings.
    `java.lang.String` | `toString()` gets a string representation of the text information frame body.

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

    - #### ID3v24FrameBodyTextInformation

          public ID3v24FrameBodyTextInformation(FrameType frameType)
                                         throws java.lang.IllegalArgumentException

      The constructor is called when creating a new frame. The default values used are:
      - ISO-8859-1 encoding
      - empty text
      Parameters:
        `frameType` - It must be one of the 45 following ID3v2.4 Text frame types. Note: All text frame types begin with the letter 'T'.

        ID3v2.4 Text Frame Typess
        | Frame Type | Frame id | Description
        --- | --- | --- | ---
        1. | ALBUM_TITLE | TALB | album/movie/show title
        2. | BEATS_PER_MINUTE | TBPM | bpm (beats per minute)
        3. | COMPOSER | TCOM | composer
        4. | CONTENT_TYPE | TCON | content type
        5. | COPYRIGHT_MESSAGE | TCOP | copyright message
        6. | ENCODING_TIME | TDEN | encoding date/time
        7. | PLAYLIST_DELAY | TDLY | playlist delay
        8. | ORIGINAL_RELEASE_TIME | TDOR | original release date/time
        9. | RECORDING_TIME | TDRC | recording date/time
        10. | RELEASE_TIME | TDRL | release date/time
        11. | TAGGING_TIME | TDTG | tagging date/time
        12. | ENCODED_BY | TENC | encoded by
        13. | LYRICIST | TEXT | lyricist/text writer
        14. | FILE_TYPE | TFLT | file type
        15. | INVOLVED_PEOPLE_LIST | TIPL | involved people list
        16. | CONTENT_GROUP_DESCRIPTION | TIT1 | content group description
        17. | SONG_TITLE | TIT2 | title/songname/content description
        18. | SUBTITLE_REFINEMENT | TIT3 | subtitle/description refinement
        19. | INITIAL_KEY | TKEY | initial key
        20. | LANGUAGE | TLAN | language(s)
        21. | LENGTH | TLEN | length of the song (in ms)
        22. | MUSICIANS_CREDIT_LIST | TMCL | musician credits lis
        23. | MEDIA_TYPE | TMED | media type
        24. | MOOD | TMOO | mood
        25. | ORIGINAL_ALBUM_TITLE | TOAL | original album/movie/show title
        26. | ORIGINAL_FILENAME | TOFN | original filename
        27. | ORIGINAL_LYRICIST | TOLY | original lyricist(s)/text writer(s)
        28. | ORIGINAL_ARTIST | TOPE | original artist(s)/performer(s)
        29. | FILE_OWNER | TOWN | file owner/licensee
        30. | LEAD_PERFORMER | TPE1 | lead performer(s)/soloist(s)
        31. | BAND | TPE2 | band/orchestra/accompaniment
        32. | CONDUCTOR | TPE3 | conductor/performer refinement
        33. | INTERPRETED_MODIFIED_BY | TPE4 | interpreted, remixed, or otherwise modified by
        34. | PART_OF_A_SET | TPOS | part of a set
        35. | PRODUCED_NOTICE | TPRO | produced notice
        36. | PUBLISHER | TPUB | publisher
        37. | TRACK_NUMBER | TRCK | track number/position in set
        38. | INTERNET_RADIO_STATION_NAME | TRSN | internet radio station name
        39. | INTERNET_RADIO_STATION_OWNER | TRSO | internet radio station owner
        40. | ALBUM_SORT_ORDER | TSOA | album sort order
        41. | PERFORMER_SORT_ORDER | TSOP | performer sort order
        42. | TITLE_SORT_ORDER | TSOT | title sort order
        43. | INTERNATIONAL_STANDARD_RECORDING_CODE | TSRC | isrc (international standard recording code)
        44. | SOFTWARE_HARDWARE_ENCODING_SETTINGS | TSSE | software/hardware and settings used for encoding
        45. | SET_SUBTITLE | TSST | set subtitle

      Throws:
        `java.lang.IllegalArgumentException` - if the frame type is not a Text frame type. ie, if the frame id does not start with the letter 'T'.

    - #### ID3v24FrameBodyTextInformation

          public ID3v24FrameBodyTextInformation(FrameType frameType,
                                        Encoding encoding,
                                        java.lang.String text)
                                         throws java.lang.IllegalArgumentException

      This constructor is called when creating a new frame.
      Parameters:
        `frameType` - one of the 45 ID3v2.4 Text frame types. See `ID3v24FrameBodyTextInformation(FrameType)`
        `encoding` - character set used to encode the text.
        `text` - text.
      Throws:
        `java.lang.IllegalArgumentException` - if the frame type is not a Text frame type. ie, if the frame id does not start with the letter 'T'.

    - #### ID3v24FrameBodyTextInformation

          public ID3v24FrameBodyTextInformation(java.io.InputStream inputStream,
                                        FrameType frameType,
                                        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 text information frame body in the .mp3 file.
        `frameType` - the type of ID3v2.4 frame.
        `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 text.
      Returns:
        the character encoding of the text.
      See Also:
        `setEncoding(Encoding)`

    - #### setEncoding

          public void setEncoding(Encoding encoding)

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

    - #### getText

          public java.lang.String getText()

      gets the text.
      Returns:
        the text.
      See Also:
        `setText(String)`

    - #### setText

          public void setText(java.lang.String text)

      sets the text.
      Parameters:
        `text` - the text.
      Throws:
        `java.lang.IllegalArgumentException` - if the text is null or an empty string.
      See Also:
        `getText()`

    - #### getTextList

          public java.util.List<java.lang.String> getTextList()

      gets the text as a list. The ID3v2.4 specification allows the text field to contain multiple strings, each separated by the encoding's null terminator character (0x00, or 0x00 0x00), depending on the character set used to encode the string. While this doesn't make sense for most of the text frames, it is used for things like the* Involved People List and the Musician Credits List frames.
      Returns:
        the text as a list of strings.
      See Also:
        `setTextList(List)`

    - #### setTextList

          public void setTextList(java.util.List<java.lang.String> textList)

      sets the text from the list of strings.
      Parameters:
        `textList` - a list of strings.
      Throws:
        `java.lang.IllegalArgumentException` - if the text list is null or empty or only contains empty strings.
      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 text information frame body.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        a string representation of the frame body.