package org.farng.mp3.id3;
import org.farng.mp3.InvalidTagException;
import org.farng.mp3.object.ObjectByteArraySizeTerminated;
import org.farng.mp3.object.ObjectStringNullTerminated;
import java.io.IOException;
import java.io.RandomAccessFile;
/**
* <h3>4.1. Unique file identifier</h3>
* <p/>
* <p> This frame's purpose is to be able to identify the audio file in a<br> database, that
* may provide more information relevant to the content.<br> Since standardisation of such a database is
* beyond this document, all<br>
* <p/>
* UFID frames begin with an 'owner identifier' field. It is a null-<br> terminated string
* with a URL [URL] containing an email address, or a<br> link to a location where an email address can be
* found, that belongs<br> to the organisation responsible for this specific database<br>
* implementation. Questions regarding the database should be sent to<br>
* <p/>
* the indicated email address. The URL should not be used for the<br> actual database
* queries. The string<br> "http://www.id3.org/dummy/ufid.html" should be used for tests. The<br>
* 'Owner identifier' must be non-empty (more than just a termination).<br>
* <p/>
* The 'Owner identifier' is then followed by the actual identifier,<br> which may be up to 64
* bytes. There may be more than one "UFID" frame<br> in a tag, but only one with the same 'Owner
* identifier'.</p>
* <p/>
* <p> <Header for 'Unique file identifier', ID: "UFID"><br>
* Owner identifier <text string> $00<br>
* Identifier
* <p/>
* <up to 64 bytes binary data><br> </p>
*
* @author Eric Farng
* @version $Revision: 1.4 $
*/
public class FrameBodyUFID extends AbstractID3v2FrameBody {
/**
* Creates a new FrameBodyUFID object.
*/
public FrameBodyUFID() {
super();
}
/**
* Creates a new FrameBodyUFID object.
*/
public FrameBodyUFID(final FrameBodyUFID body) {
super(body);
}
/**
* Creates a new FrameBodyUFID object.
*/
public FrameBodyUFID(final String owner, final byte[] identifier) {
setObject("Owner", owner);
setObject("Identifier", identifier);
}
/**
* Creates a new FrameBodyUFID object.
*/
public FrameBodyUFID(final RandomAccessFile file) throws IOException, InvalidTagException {
this.read(file);
}
public String getIdentifier() {
return "UFID" + ((char) 0) + getOwner();
}
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 ObjectByteArraySizeTerminated("Identifier"));
}
}