com.beaglebuddy.id3.v23.frame_body

## Class ID3v23FrameBodyEncryptionMethodRegistration

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

-     public class ID3v23FrameBodyEncryptionMethodRegistration
      extends ID3v23FrameBody

  An encryption method registration frame body is associated with an ID3v2.3 `ENCR` `frame` which is used to identify with which method a frame has been encrypted. Thus, the encryption method must be registered so that the encrypted frame(s) can be decrypyted at a later time. The encryption method registration frame body contains the following fields:

  Encryption Method Registration Frame Body Fields
  | Field | Description
  --- | --- | ---
  1. | ownerId | URL containing an e-mail address, or a link to a location where an e-mail address can be found, that belongs to the organization responsible for this specific encryption method. Questions regarding the encryption method should be sent to the indicated e-mail address.
  2. | methodSymbol | encryption method id. Values below 0x80 are reserved.
  3. | data | This is an optional field that, if specified, contains encryption data specific to this encryption method.

  There may be more than one encrypted method registration frame in an ID3v2.3 `tag`, but only one with the same method symbol and only one containing the same owner identifier. The encryption method must be used somewhere in the 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
    `ID3v23FrameBodyEncryptionMethodRegistration()` The default constructor is called when creating a new frame.
    `ID3v23FrameBodyEncryptionMethodRegistration(java.io.InputStream inputStream, int frameBodySize)` constructor.
    `ID3v23FrameBodyEncryptionMethodRegistration(java.lang.String ownerId, byte methodSymbol, byte[] data)` This constructor is called when creating a new frame.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `getData()` gets the data specific to the encryption method so that is used to encrypt/decrypt frames.
    `byte` | `getMethodSymbol()` gets the id of the encryption method.
    `java.lang.String` | `getOwnerId()` gets the owner id of the frame.
    `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` | `setData(byte[] data)` sets the data specific to the encryption method so that is used to encrypt/decrypt frames.
    `void` | `setMethodSymbol(byte methodSymbol)` sets the id of encryption method.
    `void` | `setOwnerId(java.lang.String ownerId)` sets the owner id, which is a URL containing an e-mail address, or a link to a location where an e-mail address can be found, that belongs to the organization responsible for the frame.
    `java.lang.String` | `toString()` gets a string representation of the encryption method registration 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, getUTF16String, getUTF8String, 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

    - #### ID3v23FrameBodyEncryptionMethodRegistration

          public ID3v23FrameBodyEncryptionMethodRegistration()

      The default constructor is called when creating a new frame. The default values used are:
      - empty owner id
      - 0 method symbol
      - no encryption data

    - #### ID3v23FrameBodyEncryptionMethodRegistration

          public ID3v23FrameBodyEncryptionMethodRegistration(java.lang.String ownerId,
                                                     byte methodSymbol,
                                                     byte[] data)

      This constructor is called when creating a new frame.
      Parameters:
        `ownerId` - a URL containing an e-mail address, or a link to a location where an e-mail address can be found, that belongs to the organization responsible for this specific encryption method.
        `methodSymbol` - id of encryption method.
        `data` - raw binary encryption data.

    - #### ID3v23FrameBodyEncryptionMethodRegistration

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

      constructor. called when reading in an existing frame from an .mp3 file.
      Parameters:
        `inputStream` - input stream pointing to an encryption method registration 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.

    - #### getOwnerId

          public java.lang.String getOwnerId()

      gets the owner id of the frame.
      Returns:
        the owner id of the frame.
      See Also:
        `setOwnerId(String)`

    - #### setOwnerId

          public void setOwnerId(java.lang.String ownerId)

      sets the owner id, which is a URL containing an e-mail address, or a link to a location where an e-mail address can be found, that belongs to the organization responsible for the frame. Questions regarding the frame should be sent to the indicated e-mail address.
      Parameters:
        `ownerId` - the id of the owner of the data.
      See Also:
        `getOwnerId()`

    - #### getMethodSymbol

          public byte getMethodSymbol()

      gets the id of the encryption method.
      Returns:
        the id of the encryption method.
      See Also:
        `setMethodSymbol(byte)`

    - #### setMethodSymbol

          public void setMethodSymbol(byte methodSymbol)

      sets the id of encryption method.
      Parameters:
        `methodSymbol` - the id of the encryption method.
      See Also:
        `getMethodSymbol()`

    - #### getData

          public byte[] getData()

      gets the data specific to the encryption method so that is used to encrypt/decrypt frames.
      Returns:
        the encryption data.
      See Also:
        `setData(byte[])`

    - #### setData

          public void setData(byte[] data)

      sets the data specific to the encryption method so that is used to encrypt/decrypt frames.
      Parameters:
        `data` - the binary encryption data.
      See Also:
        `getData()`

    - #### 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 encryption method registration 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.