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

COVERAGE SUMMARY FOR SOURCE FILE [FieldBodyUnsupported.java]

nameclass, %method, %block, %line, %
FieldBodyUnsupported.java0%   (0/1)0%   (0/11)0%   (0/189)0%   (0/46)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class FieldBodyUnsupported0%   (0/1)0%   (0/11)0%   (0/189)0%   (0/46)
FieldBodyUnsupported (): void 0%   (0/1)0%   (0/6)0%   (0/3)
FieldBodyUnsupported (FieldBodyUnsupported): void 0%   (0/1)0%   (0/13)0%   (0/4)
FieldBodyUnsupported (RandomAccessFile): void 0%   (0/1)0%   (0/9)0%   (0/4)
FieldBodyUnsupported (byte []): void 0%   (0/1)0%   (0/9)0%   (0/4)
equals (Object): boolean 0%   (0/1)0%   (0/20)0%   (0/6)
getIdentifier (): String 0%   (0/1)0%   (0/2)0%   (0/1)
isSubsetOf (Object): boolean 0%   (0/1)0%   (0/30)0%   (0/8)
read (RandomAccessFile): void 0%   (0/1)0%   (0/27)0%   (0/6)
setupObjectList (): void 0%   (0/1)0%   (0/1)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/16)0%   (0/1)
write (RandomAccessFile): void 0%   (0/1)0%   (0/56)0%   (0/11)

1package org.farng.mp3.lyrics3;
2 
3import java.io.IOException;
4import java.io.RandomAccessFile;
5 
6/**
7 * This is used if the field identifier is not recognized. the contents of the frame are read as a byte stream and kept
8 * so they can be saved when the file is written again
9 *
10 * @author Eric Farng
11 * @version $Revision: 1.4 $
12 */
13public class FieldBodyUnsupported extends AbstractLyrics3v2FieldBody {
14 
15    private byte[] value = null;
16 
17    /**
18     * Creates a new FieldBodyUnsupported object.
19     */
20    public FieldBodyUnsupported() {
21        super();
22    }
23 
24    /**
25     * Creates a new FieldBodyUnsupported object.
26     */
27    public FieldBodyUnsupported(final FieldBodyUnsupported copyObject) {
28        super(copyObject);
29        this.value = (byte[]) copyObject.value.clone();
30    }
31 
32    /**
33     * Creates a new FieldBodyUnsupported object.
34     */
35    public FieldBodyUnsupported(final byte[] value) {
36        this.value = value;
37    }
38 
39    /**
40     * Creates a new FieldBodyUnsupported object.
41     */
42    public FieldBodyUnsupported(final RandomAccessFile file) throws java.io.IOException {
43        this.read(file);
44    }
45 
46    public String getIdentifier() {
47        return "ZZZ";
48    }
49 
50    public boolean isSubsetOf(final Object object) {
51        if ((object instanceof FieldBodyUnsupported) == false) {
52            return false;
53        }
54        final FieldBodyUnsupported fieldBodyUnsupported = (FieldBodyUnsupported) object;
55        final String subset = new String(this.value);
56        final String superset = new String(fieldBodyUnsupported.value);
57        if (superset.indexOf(subset) < 0) {
58            return false;
59        }
60        return super.isSubsetOf(object);
61    }
62 
63    public boolean equals(final Object obj) {
64        if ((obj instanceof FieldBodyUnsupported) == false) {
65            return false;
66        }
67        final FieldBodyUnsupported fieldBodyUnsupported = (FieldBodyUnsupported) obj;
68        if (java.util.Arrays.equals(this.value, fieldBodyUnsupported.value) == false) {
69            return false;
70        }
71        return super.equals(obj);
72    }
73 
74    protected void setupObjectList() {
75//        throw new UnsupportedOperationException();
76    }
77 
78    public void read(final RandomAccessFile file) throws IOException {
79        final int size;
80        final byte[] buffer = new byte[5];
81 
82        // read the 5 character size
83        file.read(buffer, 0, 5);
84        size = Integer.parseInt(new String(buffer, 0, 5));
85        this.value = new byte[size];
86 
87        // read the SIZE length description
88        file.read(this.value);
89    }
90 
91    public String toString() {
92        return getIdentifier() + " : " + (new String(this.value));
93    }
94 
95    public void write(final RandomAccessFile file) throws IOException {
96        int offset = 0;
97        final String str;
98        final byte[] buffer = new byte[5];
99        str = Integer.toString(this.value.length);
100        for (int i = 0; i < (5 - str.length()); i++) {
101            buffer[i] = (byte) '0';
102        }
103        offset += (5 - str.length());
104        for (int i = 0; i < str.length(); i++) {
105            buffer[i + offset] = (byte) str.charAt(i);
106        }
107        file.write(buffer);
108        file.write(this.value);
109    }
110}

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