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.ObjectStringSizeTerminated; |
6 | |
7 | import java.io.IOException; |
8 | import java.io.RandomAccessFile; |
9 | |
10 | /** |
11 | * All frames starting with "T" are the same structurally and subclass from here |
12 | * |
13 | * @author Eric Farng |
14 | * @version $Revision: 1.4 $ |
15 | */ |
16 | public abstract class AbstractFrameBodyTextInformation extends AbstractID3v2FrameBody { |
17 | |
18 | /** |
19 | * Creates a new FrameBodyTextInformation object. |
20 | */ |
21 | protected AbstractFrameBodyTextInformation() { |
22 | super(); |
23 | } |
24 | |
25 | /** |
26 | * Creates a new AbstractFrameBodyTextInformation object. |
27 | */ |
28 | protected AbstractFrameBodyTextInformation(final AbstractFrameBodyTextInformation body) { |
29 | super(body); |
30 | } |
31 | |
32 | /** |
33 | * Creates a new FrameBodyTextInformation object. |
34 | */ |
35 | protected AbstractFrameBodyTextInformation(final byte textEncoding, final String text) { |
36 | super(); |
37 | setObject("Text Encoding", new Byte(textEncoding)); |
38 | setObject("Text", text); |
39 | } |
40 | |
41 | /** |
42 | * Creates a new FrameBodyTextInformation object. |
43 | */ |
44 | protected AbstractFrameBodyTextInformation(final RandomAccessFile file) throws IOException, InvalidTagException { |
45 | super(); |
46 | read(file); |
47 | } |
48 | |
49 | public String getBriefDescription() { |
50 | return getText(); |
51 | } |
52 | |
53 | public void setText(final String text) { |
54 | setObject("Text", text); |
55 | } |
56 | |
57 | public String getText() { |
58 | return (String) getObject("Text"); |
59 | } |
60 | |
61 | public void setTextEncoding(final byte textEncoding) { |
62 | setObject("Text Encoding", new Byte(textEncoding)); |
63 | } |
64 | |
65 | public byte getTextEncoding() { |
66 | return ((Byte) getObject("Text Encoding")).byteValue(); |
67 | } |
68 | |
69 | protected void setupObjectList() { |
70 | appendToObjectList(new ObjectNumberHashMap("Text Encoding", 1)); |
71 | appendToObjectList(new ObjectStringSizeTerminated("Text")); |
72 | } |
73 | } |