1 | package org.farng.mp3.id3; |
2 | |
3 | import org.farng.mp3.InvalidTagException; |
4 | import org.farng.mp3.object.ObjectNumberVariableLength; |
5 | |
6 | import java.io.IOException; |
7 | import java.io.RandomAccessFile; |
8 | |
9 | /** |
10 | * <h3>4.16. Play counter</h3> |
11 | * <p/> |
12 | * <p> This is simply a counter of the number of times a file has been<br> |
13 | * <p/> |
14 | * played. The value is increased by one every time the file begins to<br> play. There may |
15 | * only be one "PCNT" frame in each tag. When the<br> counter reaches all one's, one byte is |
16 | * inserted in front of the<br> counter thus making the counter eight bits bigger. The counter |
17 | * must<br> |
18 | * <p/> |
19 | * be at least 32-bits long to begin with.</p> |
20 | * <p/> |
21 | * <p> <Header for 'Play counter', ID: "PCNT"><br> |
22 | * Counter $xx xx xx xx (xx ...)<br> </p> |
23 | * |
24 | * @author Eric Farng |
25 | * @version $Revision: 1.4 $ |
26 | */ |
27 | public class FrameBodyPCNT extends AbstractID3v2FrameBody { |
28 | |
29 | /** |
30 | * Creates a new FrameBodyPCNT object. |
31 | */ |
32 | public FrameBodyPCNT() { |
33 | super(); |
34 | } |
35 | |
36 | /** |
37 | * Creates a new FrameBodyPCNT object. |
38 | */ |
39 | public FrameBodyPCNT(final FrameBodyPCNT body) { |
40 | super(body); |
41 | } |
42 | |
43 | /** |
44 | * Creates a new FrameBodyPCNT object. |
45 | */ |
46 | public FrameBodyPCNT(final long counter) { |
47 | setObject("Counter", new Long(counter)); |
48 | } |
49 | |
50 | /** |
51 | * Creates a new FrameBodyPCNT object. |
52 | */ |
53 | public FrameBodyPCNT(final RandomAccessFile file) throws IOException, InvalidTagException { |
54 | this.read(file); |
55 | } |
56 | |
57 | public String getIdentifier() { |
58 | return "PCNT"; |
59 | } |
60 | |
61 | protected void setupObjectList() { |
62 | appendToObjectList(new ObjectNumberVariableLength("Counter", 4)); |
63 | } |
64 | } |