1 | package org.farng.mp3.id3; |
2 | |
3 | import org.farng.mp3.InvalidTagException; |
4 | import org.farng.mp3.object.ObjectNumberHashMap; |
5 | import org.farng.mp3.object.ObjectStringDate; |
6 | import org.farng.mp3.object.ObjectStringNullTerminated; |
7 | import org.farng.mp3.object.ObjectStringSizeTerminated; |
8 | |
9 | import java.io.IOException; |
10 | import java.io.RandomAccessFile; |
11 | |
12 | /** |
13 | * <h3>4.23. Ownership frame</h3> |
14 | * <p/> |
15 | * <p> The ownership frame might be used as a reminder of a made transaction<br> or, if signed, |
16 | * as proof. Note that the "USER" and "TOWN" frames are<br> good to use in conjunction |
17 | * with this one. The frame begins, after the<br> |
18 | * <p/> |
19 | * frame ID, size and encoding fields, with a 'price paid' field. The<br> first three |
20 | * characters of this field contains the currency used for<br> the transaction, encoded according to ISO |
21 | * 4217 [ISO-4217] alphabetic<br> currency code. Concatenated to this is the actual price paid, as a<br> |
22 | * numerical string using "." as the decimal separator. Next is an 8<br> |
23 | * <p/> |
24 | * character date string (YYYYMMDD) followed by a string with the name<br> of the seller as |
25 | * the last field in the frame. There may only be one<br> "OWNE" frame in a tag.</p> |
26 | * <p/> |
27 | * <p> <Header for 'Ownership frame', ID: "OWNE"><br> |
28 | * <p/> |
29 | * Text encoding $xx<br> Price |
30 | * paid <text string> $00<br> Date of |
31 | * purch. <text string><br> |
32 | * <p/> |
33 | * Seller <text string |
34 | * according to encoding><br> </p> |
35 | * |
36 | * @author Eric Farng |
37 | * @version $Revision: 1.4 $ |
38 | */ |
39 | public class FrameBodyOWNE extends AbstractID3v2FrameBody { |
40 | |
41 | /** |
42 | * Creates a new FrameBodyOWNE object. |
43 | */ |
44 | public FrameBodyOWNE() { |
45 | super(); |
46 | } |
47 | |
48 | /** |
49 | * Creates a new FrameBodyOWNE object. |
50 | */ |
51 | public FrameBodyOWNE(final FrameBodyOWNE body) { |
52 | super(body); |
53 | } |
54 | |
55 | /** |
56 | * Creates a new FrameBodyOWNE object. |
57 | */ |
58 | public FrameBodyOWNE(final byte textEncoding, |
59 | final String pricePaid, |
60 | final String dateOfPurchase, |
61 | final String seller) { |
62 | setObject("Text Encoding", new Byte(textEncoding)); |
63 | setObject("Price Paid", pricePaid); |
64 | setObject("Date Of Purchase", dateOfPurchase); |
65 | setObject("Seller", seller); |
66 | } |
67 | |
68 | /** |
69 | * Creates a new FrameBodyOWNE object. |
70 | */ |
71 | public FrameBodyOWNE(final RandomAccessFile file) throws IOException, InvalidTagException { |
72 | this.read(file); |
73 | } |
74 | |
75 | public String getIdentifier() { |
76 | return "OWNE"; |
77 | } |
78 | |
79 | protected void setupObjectList() { |
80 | appendToObjectList(new ObjectNumberHashMap(ObjectNumberHashMap.TEXT_ENCODING, 1)); |
81 | appendToObjectList(new ObjectStringNullTerminated("Price Paid")); |
82 | appendToObjectList(new ObjectStringDate("Date Of Purchase")); |
83 | appendToObjectList(new ObjectStringSizeTerminated("Seller")); |
84 | } |
85 | } |