Example #1
0
  /**
   * if the ID3v2.4 tag header's values have been modified, then resize the raw binary buffer and
   * store the new values there. When finished, reset the dirty flag to indicate that the buffer is
   * up to date, and the tag header is now ready to be saved to the .mp3 file.
   */
  public void setBuffer() {
    System.arraycopy(version.getIdBytes(), 0, header, 0, ID3TagVersion.NUM_ID_BYTES);
    header[5] =
        (byte)
            (unsynchronization
                ? header[5] | TAG_HEADER_UNSYNCHRONIZATION_MASK
                : header[5] & ~TAG_HEADER_UNSYNCHRONIZATION_MASK);
    header[5] =
        (byte)
            (extendedHeaderPresent
                ? header[5] | TAG_HEADER_EXTENDED_HEADER_PRESENT_MASK
                : header[5] & ~TAG_HEADER_EXTENDED_HEADER_PRESENT_MASK);
    header[5] =
        (byte)
            (experimentalIndicator
                ? header[5] | TAG_HEADER_EXPERIMENTAL_INDICATOR_MASK
                : header[5] & ~TAG_HEADER_EXPERIMENTAL_INDICATOR_MASK);
    header[5] =
        (byte)
            (footerPresent
                ? header[5] | TAG_HEADER_FOOTER_PRESENT_MASK
                : header[5] & ~TAG_HEADER_FOOTER_PRESENT_MASK);
    System.arraycopy(ID3v24FrameBodyUtility.synchsafeIntToBytes(tagSize), 0, header, 6, 4);

    dirty = false;
  }
Example #2
0
  /**
   * The default constructor is called when creating a new ID3v2.4 tag header. The default values
   * used are:
   *
   * <ul>
   *   <li>tag size is 0 bytes
   *   <li>unsynchronization
   *   <li>no extended header present
   *   <li>experimental indicator is false
   *   <li>no footer present
   * </ul>
   */
  public ID3v24TagHeader() {
    header = new byte[TAG_HEADER_SIZE];
    version = ID3TagVersion.ID3V2_4;
    tagSize = 0;
    unsynchronization = true;
    extendedHeaderPresent = false;
    experimentalIndicator = false;
    footerPresent = false;
    dirty =
        true; // the tag header has been created, but the values have not yet been written to the
    // raw binary buffer

    System.arraycopy(version.getIdBytes(), 0, header, 0, ID3TagVersion.NUM_ID_BYTES);
  }