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; /** * <h3>4.28.   Signature frame</h3> * <p/> * <p>   This frame enables a group of frames, grouped with the 'Group<br>    identification * registration', to be signed. Although signatures can<br> * <p/> *    reside inside the registration frame, it might be desired to store<br>    the signature * elsewhere, e.g. in watermarks. There may be more than<br>    one 'signature frame' in a tag, but no two may * be identical.</p> * <p/> * <p>     <Header for 'Signature frame', ID: "SIGN"><br> * <p/> *      Group symbol      $xx<br>      * Signature         <binary data><br> </p> * * @author Eric Farng * @version $Revision: 2374 $ */ public class FrameBodySIGN extends AbstractID3v2FrameBody { /** * Creates a new FrameBodySIGN object. */ public FrameBodySIGN() { super(); } /** * Creates a new FrameBodySIGN object. */ public FrameBodySIGN(final FrameBodySIGN body) { super(body); } /** * Creates a new FrameBodySIGN object. */ public FrameBodySIGN(final byte groupSymbol, final byte[] signature) { setObject("Group Symbol", new Byte(groupSymbol)); setObject("Signature", signature); } /** * Creates a new FrameBodySIGN object. */ public FrameBodySIGN(final RandomAccessFile file) throws IOException, InvalidTagException { this.read(file); } public void setGroupSymbol(final byte groupSymbol) { setObject("Group Symbol", new Byte(groupSymbol)); } public byte getGroupSymbol() { if (getObject("Group Symbol") != null) { return ((Byte) getObject("Group Symbol")).byteValue(); } return 0; } public String getIdentifier() { return "SIGN" + ((char) 0) + getGroupSymbol() + ((char) 0) + (new String(getSignature())); } public void setSignature(final byte[] signature) { setObject("Signature", signature); } public byte[] getSignature() { return (byte[]) getObject("Signature"); } protected void setupObjectList() { appendToObjectList(new ObjectNumberFixedLength("Group Symbol", 1)); appendToObjectList(new ObjectByteArraySizeTerminated("Signature")); } }