1 | package org.farng.mp3; |
2 | |
3 | import java.io.IOException; |
4 | import java.io.RandomAccessFile; |
5 | |
6 | /** |
7 | * This class is a facade for all classes that can write to an MP3 file. It has abstract methods that needs to be |
8 | * implemented, and a few default implementations of other methods. |
9 | * |
10 | * @author Eric Farng |
11 | * @version $Revision: 1.2 $ |
12 | */ |
13 | public abstract class AbstractMP3FileItem { |
14 | |
15 | /** |
16 | * Creates a new AbstractMP3FileItem object. |
17 | */ |
18 | protected AbstractMP3FileItem() { |
19 | super(); |
20 | } |
21 | |
22 | /** |
23 | * Creates a new AbstractMP3FileItem object. |
24 | */ |
25 | protected AbstractMP3FileItem(final AbstractMP3FileItem copyObject) { |
26 | super(); |
27 | } |
28 | |
29 | /** |
30 | * ID string that usually corresponds to the class name, but can be displayed to the user. It is not indended to |
31 | * identify each individual instance. |
32 | * |
33 | * @return ID string |
34 | */ |
35 | public abstract String getIdentifier(); |
36 | |
37 | public abstract int getSize(); |
38 | |
39 | /** |
40 | * import java.io.IOException; import java.io.RandomAccessFile; read from current file pointer position. |
41 | * |
42 | * @param file file to read from |
43 | * |
44 | * @throws TagException on any exception generated by this library. |
45 | * @throws IOException on any I/O error |
46 | */ |
47 | public abstract void read(RandomAccessFile file) throws TagException, IOException; |
48 | |
49 | /** |
50 | * Method to write this object to the file argument at is current file pointer position. |
51 | * |
52 | * @param file file to write to |
53 | * |
54 | * @throws IOException on any I/O error |
55 | */ |
56 | public abstract void write(RandomAccessFile file) throws TagException, IOException; |
57 | |
58 | /** |
59 | * Returns true if this object is a subset of the argument. This instance is a subset if it is the same class as the |
60 | * argument. |
61 | * |
62 | * @param object object to determine subset of |
63 | * |
64 | * @return true if this instance and its entire object array list is a subset of the argument. |
65 | */ |
66 | public boolean isSubsetOf(final Object object) { |
67 | return object instanceof AbstractMP3FileItem; |
68 | } |
69 | |
70 | /** |
71 | * Returns true if this object and its body equals the argument and its body. this object is equal if and only if |
72 | * they are the same class |
73 | * |
74 | * @param obj object to determine equality of |
75 | * |
76 | * @return true if this object and its body are equal |
77 | */ |
78 | public boolean equals(final Object obj) { |
79 | return obj instanceof AbstractMP3FileItem; |
80 | } |
81 | } |