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

COVERAGE SUMMARY FOR SOURCE FILE [AbstractLyrics3.java]

nameclass, %method, %block, %line, %
AbstractLyrics3.java100% (1/1)80%  (4/5)20%  (21/103)26%  (10/39)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AbstractLyrics3100% (1/1)80%  (4/5)20%  (21/103)26%  (10/39)
append (RandomAccessFile): void 0%   (0/1)0%   (0/30)0%   (0/12)
overwrite (RandomAccessFile): void 100% (1/1)17%  (5/30)25%  (3/12)
delete (RandomAccessFile): void 100% (1/1)25%  (9/36)27%  (3/11)
AbstractLyrics3 (): void 100% (1/1)100% (3/3)100% (2/2)
AbstractLyrics3 (AbstractLyrics3): void 100% (1/1)100% (4/4)100% (2/2)

1package org.farng.mp3.lyrics3;
2 
3import org.farng.mp3.AbstractMP3Tag;
4import org.farng.mp3.TagException;
5import org.farng.mp3.TagNotFoundException;
6import org.farng.mp3.id3.ID3v1;
7 
8import java.io.IOException;
9import java.io.RandomAccessFile;
10 
11/**
12 * Super class for both Lyrics3v2 and Lyrics3v2 tags
13 *
14 * @author Eric Farng
15 * @version $Revision: 1.3 $
16 */
17public abstract class AbstractLyrics3 extends AbstractMP3Tag {
18 
19    /**
20     * Creates a new AbstractLyrics3 object.
21     */
22    public AbstractLyrics3() {
23        super();
24    }
25 
26    /**
27     * Creates a new AbstractLyrics3 object.
28     */
29    public AbstractLyrics3(final AbstractLyrics3 copyObject) {
30        super(copyObject);
31    }
32 
33    public void append(final RandomAccessFile file) throws IOException, TagException {
34        AbstractLyrics3 oldTag;
35        try {
36            oldTag = new Lyrics3v2(file);
37            oldTag.append(this);
38            oldTag.write(file);
39        } catch (TagNotFoundException ex) {
40            try {
41                oldTag = new Lyrics3v1(file);
42                oldTag.append(this);
43                oldTag.write(file);
44            } catch (TagNotFoundException ex2) {
45                this.write(file);
46            }
47        }
48    }
49 
50    public void delete(final RandomAccessFile file) throws IOException {
51        long filePointer;
52        ID3v1 id3v1tag = new ID3v1();
53        if (seek(file)) {
54            id3v1tag = id3v1tag.getID3tag(file);
55            seek(file);
56            filePointer = file.getFilePointer();
57 
58            // cut off the "LYRICSBEGIN"
59            filePointer -= 11;
60            file.setLength(filePointer);
61            file.seek(file.length());
62            if (id3v1tag != null) {
63                id3v1tag.write(file);
64            }
65        }
66    }
67 
68    public void overwrite(final RandomAccessFile file) throws IOException, TagException {
69        AbstractLyrics3 oldTag;
70        try {
71            oldTag = new Lyrics3v2(file);
72            oldTag.overwrite(this);
73            oldTag.write(file);
74        } catch (TagNotFoundException ex) {
75            try {
76                oldTag = new Lyrics3v1(file);
77                oldTag.overwrite(this);
78                oldTag.write(file);
79            } catch (TagNotFoundException ex2) {
80                this.write(file);
81            }
82        }
83    }
84}

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