package org.farng.mp3.id3; import java.io.IOException; import java.io.RandomAccessFile; import org.farng.mp3.InvalidTagException; import org.farng.mp3.object.ObjectByteArraySizeTerminated; import org.farng.mp3.object.ObjectNumberFixedLength; import org.farng.mp3.object.ObjectStringNullTerminated; /** * <h3>4.26.   Group identification registration</h3> * <p/> * <p>   This frame enables grouping of otherwise unrelated frames. This can<br> * <p/> *    be used when some frames are to be signed. To identify which frames<br>    belongs to a set of * frames a group identifier must be registered in<br>    the tag with this frame. The 'Owner identifier' is a * null-terminated<br>    string with a URL [URL] containing an email address, or a link to a<br>    * location where an email address can be found, that belongs to the<br> * <p/> *    organisation responsible for this grouping. Questions regarding the<br>    grouping should be * sent to the indicated email address. The 'Group<br>    symbol' contains a value that associates the frame * with this group<br>    throughout the whole tag, in the range $80-F0. All other values are<br>    * reserved. The 'Group symbol' may optionally be followed by some group<br> * <p/> *    specific data, e.g. a digital signature. There may be several "GRID"<br>    frames * in a tag but only one containing the same symbol and only one<br>    containing the same owner identifier. * The group symbol must be used<br>    somewhere in the tag. See the description of the frame grouping * flag<br> * <p/> *    in the ID3v2 structure document [ID3v2-strct] for more information.</p> * <p/> * <p>     <Header for 'Group ID registration', ID: "GRID"><br> *      Owner identifier      <text string> $00<br> * <p/> *      Group symbol          $xx<br> *      Group dependent data  <binary data><br> </p> * * @author Eric Farng * @version $Revision: 2374 $ */ public class FrameBodyGRID extends AbstractID3v2FrameBody { /** * Creates a new FrameBodyGRID object. */ public FrameBodyGRID() { super(); } /** * Creates a new FrameBodyGRID object. */ public FrameBodyGRID(final FrameBodyGRID body) { super(body); } /** * Creates a new FrameBodyGRID object. */ public FrameBodyGRID(final String owner, final byte groupSymbol, final byte[] data) { setObject("Owner", owner); setObject("Group Symbol", new Byte(groupSymbol)); setObject("Group Dependent Data", data); } /** * Creates a new FrameBodyGRID object. */ public FrameBodyGRID(final RandomAccessFile file) throws IOException, InvalidTagException { this.read(file); } public void setGroupSymbol(final byte textEncoding) { setObject("Group Symbol", new Byte(textEncoding)); } public byte getGroupSymbol() { if (getObject("Group Symbol") != null) { return ((Byte) getObject("Group Symbol")).byteValue(); } return 0; } public String getIdentifier() { return "GRID" + ((char) 0) + getOwner() + ((char) 0) + getGroupSymbol(); } public void setOwner(final String owner) { setObject("Owner", owner); } public String getOwner() { return (String) getObject("Owner"); } protected void setupObjectList() { appendToObjectList(new ObjectStringNullTerminated("Owner")); appendToObjectList(new ObjectNumberFixedLength("Group Symbol", 1)); appendToObjectList(new ObjectByteArraySizeTerminated("Group Dependent Data")); } }