package org.farng.mp3.id3;
import org.farng.mp3.InvalidTagException;
import org.farng.mp3.object.ObjectNumberHashMap;
import org.farng.mp3.object.ObjectStringDate;
import org.farng.mp3.object.ObjectStringNullTerminated;
import org.farng.mp3.object.ObjectStringSizeTerminated;
import java.io.IOException;
import java.io.RandomAccessFile;
/**
* <h3>4.23. Ownership frame</h3>
* <p/>
* <p> The ownership frame might be used as a reminder of a made transaction<br> or, if signed,
* as proof. Note that the "USER" and "TOWN" frames are<br> good to use in conjunction
* with this one. The frame begins, after the<br>
* <p/>
* frame ID, size and encoding fields, with a 'price paid' field. The<br> first three
* characters of this field contains the currency used for<br> the transaction, encoded according to ISO
* 4217 [ISO-4217] alphabetic<br> currency code. Concatenated to this is the actual price paid, as a<br>
* numerical string using "." as the decimal separator. Next is an 8<br>
* <p/>
* character date string (YYYYMMDD) followed by a string with the name<br> of the seller as
* the last field in the frame. There may only be one<br> "OWNE" frame in a tag.</p>
* <p/>
* <p> <Header for 'Ownership frame', ID: "OWNE"><br>
* <p/>
* Text encoding $xx<br> Price
* paid <text string> $00<br> Date of
* purch. <text string><br>
* <p/>
* Seller <text string
* according to encoding><br> </p>
*
* @author Eric Farng
* @version $Revision: 1.4 $
*/
public class FrameBodyOWNE extends AbstractID3v2FrameBody {
/**
* Creates a new FrameBodyOWNE object.
*/
public FrameBodyOWNE() {
super();
}
/**
* Creates a new FrameBodyOWNE object.
*/
public FrameBodyOWNE(final FrameBodyOWNE body) {
super(body);
}
/**
* Creates a new FrameBodyOWNE object.
*/
public FrameBodyOWNE(final byte textEncoding,
final String pricePaid,
final String dateOfPurchase,
final String seller) {
setObject("Text Encoding", new Byte(textEncoding));
setObject("Price Paid", pricePaid);
setObject("Date Of Purchase", dateOfPurchase);
setObject("Seller", seller);
}
/**
* Creates a new FrameBodyOWNE object.
*/
public FrameBodyOWNE(final RandomAccessFile file) throws IOException, InvalidTagException {
this.read(file);
}
public String getIdentifier() {
return "OWNE";
}
protected void setupObjectList() {
appendToObjectList(new ObjectNumberHashMap(ObjectNumberHashMap.TEXT_ENCODING, 1));
appendToObjectList(new ObjectStringNullTerminated("Price Paid"));
appendToObjectList(new ObjectStringDate("Date Of Purchase"));
appendToObjectList(new ObjectStringSizeTerminated("Seller"));
}
}