com.beaglebuddy.id3.v23.frame_body

## Class ID3v23FrameBodyUtility

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

- Direct Known Subclasses:
    ID3v23FrameBody

      public class ID3v23FrameBodyUtility
      extends Utility

  Base class for the body of ID3V2.3 frames. This class is simply a collection of utility methods and is not a frame body type.
  See Also:
    ID3 tag version 2.3.0 standard, wikipedia history of ID3 tags

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `nextNullTerminatorIndex`
    `protected int` | `nullTerminatorIndex`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ID3v23FrameBodyUtility()` default constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static int` | `getNextNullTerminator(byte[] buffer, int startingFrom, Encoding encoding)` finds the next null terminating character in the raw data stream according to the specified character encoding.
    `static java.lang.String` | `pricesToString(java.util.List<Price> prices)` convert a list of prices to a string, with each price separated by the "/" character. example: USD0.99/EUR1.00/GBP0.65
    `static byte[]` | `stringToBytes(Encoding encoding, java.lang.String string)` converts a String to a byte array using a specified character set encoding.

    - ### 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, toString, wait, wait, wait`

- - ### Field Detail

    - #### nullTerminatorIndex

          protected int nullTerminatorIndex

    - #### nextNullTerminatorIndex

          protected int nextNullTerminatorIndex

  - ### Constructor Detail

    - #### ID3v23FrameBodyUtility

          public ID3v23FrameBodyUtility()

      default constructor.

  - ### Method Detail

    - #### getNextNullTerminator

          public static int getNextNullTerminator(byte[] buffer,
                                  int startingFrom,
                                  Encoding encoding)

      finds the next null terminating character in the raw data stream according to the specified character encoding. A null character is represented as a single 0x00 byte in some character encodings and as two bytes 0x00 0x00 in others.
      Parameters:
        `buffer` - the raw binary bytes in which to find the next null terminator character.
        `startingFrom` - the index at which to start searching from in the data.
        `encoding` - the character set used to encode the string (and hence determine the null terminating character).
      Returns:
        the index of the next null terminator in the data.

    - #### stringToBytes

          public static byte[] stringToBytes(Encoding encoding,
                             java.lang.String string)

      converts a String to a byte array using a specified character set encoding. The String class has a getBytes() method, but that method does not include a null terminator in the byte array that it returns. This method does.
      Parameters:
        `encoding` - the encoding to use when converting the string to a byte array.
        `string` - the string to be converted to a byte array.
      Returns:
        a byte array holding the string value in the specified encoding with null terminating bytes.

    - #### pricesToString

          public static java.lang.String pricesToString(java.util.List<Price> prices)

      convert a list of prices to a string, with each price separated by the "/" character.
      example: USD0.99/EUR1.00/GBP0.65
      Parameters:
        `prices` - list of prices.
      Returns:
        a string representation of the list of price(s).