EMMA Coverage Report (generated Tue Mar 14 21:50:42 EST 2006)
[all classes][org.farng.mp3.object]

COVERAGE SUMMARY FOR SOURCE FILE [ObjectID3v2LyricLine.java]

nameclass, %method, %block, %line, %
ObjectID3v2LyricLine.java100% (1/1)100% (11/11)91%  (220/242)95%  (42/44)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ObjectID3v2LyricLine100% (1/1)100% (11/11)91%  (220/242)95%  (42/44)
readByteArray (byte [], int): void 100% (1/1)70%  (51/73)80%  (8/10)
ObjectID3v2LyricLine (ObjectID3v2LyricLine): void 100% (1/1)100% (21/21)100% (6/6)
ObjectID3v2LyricLine (String): void 100% (1/1)100% (12/12)100% (5/5)
equals (Object): boolean 100% (1/1)100% (28/28)100% (8/8)
getSize (): int 100% (1/1)100% (8/8)100% (1/1)
getText (): String 100% (1/1)100% (3/3)100% (1/1)
getTimeStamp (): long 100% (1/1)100% (3/3)100% (1/1)
setText (String): void 100% (1/1)100% (4/4)100% (2/2)
setTimeStamp (long): void 100% (1/1)100% (4/4)100% (2/2)
toString (): String 100% (1/1)100% (13/13)100% (1/1)
writeByteArray (): byte [] 100% (1/1)100% (73/73)100% (9/9)

1package org.farng.mp3.object;
2 
3/**
4 * ID3v2 and Lyrics3v2 tags have individual fields <code>AbstractMP3Fragment</code>s Then each fragment is broken down
5 * in to individual <code>AbstractMP3Object</code>s
6 *
7 * @author Eric Farng
8 * @version $Revision: 1.5 $
9 */
10public class ObjectID3v2LyricLine extends AbstractMP3Object {
11 
12    String text = "";
13    long timeStamp = 0;
14 
15    /**
16     * Creates a new ObjectID3v2LyricLine object.
17     */
18    public ObjectID3v2LyricLine(final String identifier) {
19        this.identifier = identifier;
20    }
21 
22    /**
23     * Creates a new ObjectID3v2LyricLine object.
24     */
25    public ObjectID3v2LyricLine(final ObjectID3v2LyricLine copyObject) {
26        super(copyObject);
27        this.text = new String(copyObject.text);
28        this.timeStamp = copyObject.timeStamp;
29    }
30 
31    public int getSize() {
32        return this.text.length() + 1 + 4;
33    }
34 
35    public void setText(final String text) {
36        this.text = text;
37    }
38 
39    public String getText() {
40        return this.text;
41    }
42 
43    public void setTimeStamp(final long timeStamp) {
44        this.timeStamp = timeStamp;
45    }
46 
47    public long getTimeStamp() {
48        return this.timeStamp;
49    }
50 
51    public boolean equals(final Object obj) {
52        if ((obj instanceof ObjectID3v2LyricLine) == false) {
53            return false;
54        }
55        final ObjectID3v2LyricLine objectID3v2LyricLine = (ObjectID3v2LyricLine) obj;
56        if (this.text.equals(objectID3v2LyricLine.text) == false) {
57            return false;
58        }
59        if (this.timeStamp != objectID3v2LyricLine.timeStamp) {
60            return false;
61        }
62        return super.equals(obj);
63    }
64 
65    public void readByteArray(final byte[] arr, final int offset) {
66        if (arr == null) {
67            throw new NullPointerException("Byte array is null");
68        }
69        if ((offset < 0) || (offset >= arr.length)) {
70            throw new IndexOutOfBoundsException("Offset to byte array is out of bounds: offset = " +
71                                                offset +
72                                                ", array.length = " +
73                                                arr
74                                                        .length);
75        }
76        this.text = new String(arr, offset, arr.length - offset - 4);
77        this.timeStamp = 0;
78        for (int i = arr.length - 4; i < arr.length; i++) {
79            this.timeStamp <<= 8;
80            this.timeStamp += arr[i];
81        }
82    }
83 
84    public String toString() {
85        return this.timeStamp + " " + this.text;
86    }
87 
88    public byte[] writeByteArray() {
89        int i;
90        final byte[] arr = new byte[getSize()];
91        for (i = 0; i < this.text.length(); i++) {
92            arr[i] = (byte) this.text.charAt(i);
93        }
94        arr[i++] = 0;
95        arr[i++] = (byte) ((this.timeStamp & 0xFF000000) >> 24);
96        arr[i++] = (byte) ((this.timeStamp & 0x00FF0000) >> 16);
97        arr[i++] = (byte) ((this.timeStamp & 0x0000FF00) >> 8);
98        arr[i] = (byte) (this.timeStamp & 0x000000FF);
99        return arr;
100    }
101}

[all classes][org.farng.mp3.object]
EMMA 2.0.5312 (C) Vladimir Roubtsov