com.beaglebuddy.id3.v23.frame_body

## Class ID3v23FrameBodyOwnership

- java.lang.Object
- - com.beaglebuddy.util.Utility
  - - com.beaglebuddy.id3.v23.frame_body.ID3v23FrameBodyUtility
    - - com.beaglebuddy.id3.v23.frame_body.ID3v23FrameBody
      - - com.beaglebuddy.id3.v23.frame_body.ID3v23FrameBodyOwnership

-     public class ID3v23FrameBodyOwnership
      extends ID3v23FrameBody

  An ownership frame body is associated with an ID3v2.3 `OWNE` `frame` which is used to indicate that a user is the owner of the .mp3 file. This frame is often used in conjunction with the `terms of use` and `file owner/licensee` frames. The ownership frame body contains the following fields:

  Ownership Frame Body Fields
  | Field | Description
  --- | --- | ---
  1. | `encoding` | character set used to `encode` the seller field.
  2. | prices | the purchase `price` of the .mp3 file. The purchase price may be specified in equivalent currencies. For example, USD1.00 = GBP0.60 = EUR1.25, etc. However, there may only be one price for a given currency. That is, you may not specify USD1.00 and USD2.00.
  3. | purchaseDate | date the .mp3 file was purchased formatted as YYYYMMDD.
  4. | seller | the name of the person or organization that sold the .mp3 file.

  There may only be one "OWNE" frame in a tag.

  See Also:
    `ID3v23Frame`, ID3 tag version 2.3.0 standard, wikipedia history of ID3 tags

- - ### Field Summary

    - ### Fields inherited from class com.beaglebuddy.id3.v23.frame_body.ID3v23FrameBody

      `buffer, dirty, frameType`

    - ### Fields inherited from class com.beaglebuddy.id3.v23.frame_body.ID3v23FrameBodyUtility

      `nextNullTerminatorIndex, nullTerminatorIndex`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ID3v23FrameBodyOwnership()` The default constructor is called when creating a new frame.
    `ID3v23FrameBodyOwnership(Encoding encoding, java.util.List<Price> prices, java.lang.String purchaseDate, java.lang.String seller)` This constructor is called when creating a new frame.
    `ID3v23FrameBodyOwnership(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
    --- | ---
    `Encoding` | `getEncoding()` gets the character encoding of the seller.
    `java.util.List<Price>` | `getPrices()` gets the price(s) of the .mp3 song.
    `java.lang.String` | `getPurchaseDate()` gets the date the mp3 song was purchased.
    `java.lang.String` | `getSeller()` sets the vendor who sold the mp3 song.
    `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 seller.
    `void` | `setPrices(java.util.List<Price> prices)` sets the price(s) of the .mp3 song.
    `void` | `setPurchaseDate(java.lang.String purchaseDate)` sets the date the mp3 song was purchased.
    `void` | `setSeller(java.lang.String seller)` sets the vendor who sold the mp3 song.
    `java.lang.String` | `toString()` gets a string representation of the ownership frame body showing all of the frame's fields and their values.

    - ### Methods inherited from class com.beaglebuddy.id3.v23.frame_body.ID3v23FrameBody

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

    - ### Methods inherited from class com.beaglebuddy.id3.v23.frame_body.ID3v23FrameBodyUtility

      `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

    - #### ID3v23FrameBodyOwnership

          public ID3v23FrameBodyOwnership()

      The default constructor is called when creating a new frame. The default values used are:
      - ISO-8859-1 encoding
      - USD 0.00 price
      - today's date
      - no seller

    - #### ID3v23FrameBodyOwnership

          public ID3v23FrameBodyOwnership(Encoding encoding,
                                  java.util.List<Price> prices,
                                  java.lang.String purchaseDate,
                                  java.lang.String seller)

      This constructor is called when creating a new frame.
      Parameters:
        `encoding` - character set used to encode the seller's name.
        `prices` - price(s) paid for the song.
        `purchaseDate` - date the mp3 song was purchased - 8 character date string (YYYYMMDD).
        `seller` - vendor who sold the mp3 song.

    - #### ID3v23FrameBodyOwnership

          public ID3v23FrameBodyOwnership(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 an ownership 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 `ID3v23FrameBody`
      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 seller.
      Returns:
        the character encoding of the seller.
      See Also:
        `setEncoding(Encoding)`

    - #### setEncoding

          public void setEncoding(Encoding encoding)

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

    - #### getPrices

          public java.util.List<Price> getPrices()

      gets the price(s) of the .mp3 song. Mulitple prices may be specified in different currencies.
      Returns:
        the price(s) of the song.
      See Also:
        `setPrices(List)`

    - #### setPrices

          public void setPrices(java.util.List<Price> prices)

      sets the price(s) of the .mp3 song. The purchase price may be specified in a single currecny (ex: USD 0.99) or in equivalent currencies (USD1.00 = GBP0.60 = EUR1.25, etc.). However, there may only be one price for a given currency. That is, you may not specify USD1.00 and USD2.00.
      Parameters:
        `prices` - price(s) paid for the .mp3 file.
      See Also:
        `getPrices()`

    - #### getPurchaseDate

          public java.lang.String getPurchaseDate()

      gets the date the mp3 song was purchased.
      Returns:
        the purchase Date.
      See Also:
        `setPurchaseDate(String)`

    - #### setPurchaseDate

          public void setPurchaseDate(java.lang.String purchaseDate)

      sets the date the mp3 song was purchased.
      Parameters:
        `purchaseDate` - the purchaseDate in the form YYYYMMDD.
      Throws:
        `java.lang.IllegalArgumentException` - if the date is not valid.
      See Also:
        `getPurchaseDate()`

    - #### getSeller

          public java.lang.String getSeller()

      sets the vendor who sold the mp3 song.
      Returns:
        the seller.
      See Also:
        `setSeller(String)`

    - #### setSeller

          public void setSeller(java.lang.String seller)

      sets the vendor who sold the mp3 song.
      Parameters:
        `seller` - the vendor who sold the mp3 song.
      See Also:
        `getSeller()`

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

    - #### toString

          public java.lang.String toString()

      gets a string representation of the ownership 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.