1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package entagged.audioformats.asf.data;
20
21 import java.math.BigInteger;
22 import java.util.ArrayList;
23 import java.util.Collection;
24 import java.util.Iterator;
25
26 import entagged.audioformats.asf.util.Utils;
27
28 /***
29 * This class was intended to store the data of a chunk which contained the
30 * encoding parameters in textual form. <br>
31 * Since the needed parameters were found in other chunks the implementation of
32 * this class was paused. <br>
33 * TODO complete analysis.
34 *
35 * @author Christian Laireiter
36 */
37 public class EncodingChunk extends Chunk {
38
39 /***
40 * The read strings.
41 */
42 private final ArrayList strings;
43
44 /***
45 * Creates an instance.
46 *
47 * @param pos
48 * Position of the chunk within file or stream
49 * @param chunkLen
50 * Length of current chunk.
51 */
52 public EncodingChunk(long pos, BigInteger chunkLen) {
53 super(GUID.GUID_ENCODING, pos, chunkLen);
54 this.strings = new ArrayList();
55 }
56
57 /***
58 * This method appends a String.
59 *
60 * @param toAdd
61 * String to add.
62 */
63 public void addString(String toAdd) {
64 strings.add(toAdd);
65 }
66
67 /***
68 * This method returns a collection of all {@link String}s which were addid
69 * due {@link #addString(String)}.
70 *
71 * @return Inserted Strings.
72 */
73 public Collection getStrings() {
74 return new ArrayList(strings);
75 }
76
77 /***
78 * (overridden)
79 *
80 * @see entagged.audioformats.asf.data.Chunk#prettyPrint()
81 */
82 public String prettyPrint() {
83 StringBuffer result = new StringBuffer(super.prettyPrint());
84 result.insert(0, Utils.LINE_SEPARATOR + "Encoding:"
85 + Utils.LINE_SEPARATOR);
86 Iterator iterator = this.strings.iterator();
87 while (iterator.hasNext()) {
88 result.append(" " + iterator.next() + Utils.LINE_SEPARATOR);
89 }
90 return result.toString();
91 }
92 }