EMMA Coverage Report (generated Thu Dec 06 15:52:10 GMT 2007)
[all classes][com.sun.tools.javac.zip]

COVERAGE SUMMARY FOR SOURCE FILE [ZipFileIndexEntry.java]

nameclass, %method, %block, %line, %
ZipFileIndexEntry.java100% (1/1)64%  (7/11)68%  (106/156)83%  (29/35)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ZipFileIndexEntry100% (1/1)64%  (7/11)68%  (106/156)83%  (29/35)
dosToJavaTime (int): long 0%   (0/1)0%   (0/3)0%   (0/1)
getLastModified (): long 0%   (0/1)0%   (0/13)0%   (0/3)
isDirectory (): boolean 0%   (0/1)0%   (0/3)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/31)0%   (0/1)
<static initializer> 100% (1/1)100% (4/4)100% (1/1)
ZipFileIndexEntry (String): void 100% (1/1)100% (32/32)100% (8/8)
ZipFileIndexEntry (String, String): void 100% (1/1)100% (10/10)100% (4/4)
compareTo (ZipFileIndexEntry): int 100% (1/1)100% (22/22)100% (6/6)
getFileName (): String 100% (1/1)100% (3/3)100% (1/1)
getName (): String 100% (1/1)100% (31/31)100% (7/7)
setNativeTime (int): void 100% (1/1)100% (4/4)100% (2/2)

1package com.sun.tools.javac.zip;
2 
3import java.io.File;
4 
5public final class ZipFileIndexEntry implements Comparable<ZipFileIndexEntry> {
6    public static final ZipFileIndexEntry[] EMPTY_ARRAY = {};
7 
8    // Directory related
9    String dir;
10    boolean isDir;
11 
12    // File related
13    String name;
14 
15    int offset;
16    int size;
17    int compressedSize;
18    long javatime;
19 
20    private int nativetime;
21 
22    public ZipFileIndexEntry(String path) {
23        int separator = path.lastIndexOf(File.separatorChar);
24        if (separator == -1) {
25            dir = "".intern();
26            name = path;
27        } else {
28            dir = path.substring(0, separator).intern();
29            name = path.substring(separator + 1);
30        }
31    }
32 
33    public ZipFileIndexEntry(String directory, String name) {
34        this.dir = directory.intern();
35        this.name = name;
36    }
37 
38    public String getName() {
39        if (dir == null || dir.length() == 0) {
40            return name;
41        }
42 
43        StringBuilder sb = new StringBuilder();
44        sb.append(dir);
45        sb.append(File.separatorChar);
46        sb.append(name);
47        return sb.toString();
48    }
49 
50    public String getFileName() {
51        return name;
52    }
53 
54    public long getLastModified() {
55        if (javatime == 0) {
56                javatime = dosToJavaTime(nativetime);
57        }
58        return javatime;
59    }
60 
61    // From java.util.zip
62    private static long dosToJavaTime(int nativetime) {
63        // Bootstrap build problems prevent me from using the code directly
64        // Convert the raw/native time to a long for now
65        return (long)nativetime;
66    }
67 
68    void setNativeTime(int natTime) {
69        nativetime = natTime;
70    }
71 
72    public boolean isDirectory() {
73        return isDir;
74    }
75 
76    public int compareTo(ZipFileIndexEntry other) {
77        String otherD = other.dir;
78        if (dir != otherD) {
79            int c = dir.compareTo(otherD);
80            if (c != 0)
81                return c;
82        }
83        return name.compareTo(other.name);
84    }
85 
86 
87    public String toString() {
88        return isDir ? ("Dir:" + dir + " : " + name) :
89            (dir + ":" + name);
90    }
91}

[all classes][com.sun.tools.javac.zip]
EMMA 2.0.5312 (C) Vladimir Roubtsov