EMMA Coverage Report (generated Thu Nov 26 15:54:18 CST 2009)
[all classes][org.eclipse.pde.api.tools.internal.util]

COVERAGE SUMMARY FOR SOURCE FILE [TarEntry.java]

nameclass, %method, %block, %line, %
TarEntry.java100% (1/1)100% (13/13)100% (85/85)100% (29/29)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class TarEntry100% (1/1)100% (13/13)100% (85/85)100% (29/29)
TarEntry (String): void 100% (1/1)100% (5/5)100% (2/2)
TarEntry (String, int): void 100% (1/1)100% (20/20)100% (7/7)
clone (): Object 100% (1/1)100% (26/26)100% (6/6)
getFileType (): int 100% (1/1)100% (3/3)100% (1/1)
getMode (): long 100% (1/1)100% (3/3)100% (1/1)
getName (): String 100% (1/1)100% (3/3)100% (1/1)
getSize (): long 100% (1/1)100% (3/3)100% (1/1)
getTime (): long 100% (1/1)100% (3/3)100% (1/1)
setFileType (int): void 100% (1/1)100% (4/4)100% (2/2)
setMode (long): void 100% (1/1)100% (4/4)100% (2/2)
setSize (long): void 100% (1/1)100% (4/4)100% (2/2)
setTime (long): void 100% (1/1)100% (4/4)100% (2/2)
toString (): String 100% (1/1)100% (3/3)100% (1/1)

1/*******************************************************************************
2 * Copyright (c) 2008, 2009 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 * 
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11package org.eclipse.pde.api.tools.internal.util;
12 
13/**
14 * Representation of a file in a tar archive.
15 */
16public class TarEntry implements Cloneable {
17        private String name;
18        private long mode, time, size;
19        private int type;
20        int filepos;
21 
22        /**
23         * Entry type for normal files.
24         */
25        public static final int FILE = '0';
26 
27        /**
28         * Entry type for directories.
29         */
30        public static final int DIRECTORY = '5';
31        
32        /**
33         * Create a new TarEntry for a file of the given name at the
34         * given position in the file.
35         * 
36         * @param name filename
37         * @param pos position in the file in bytes
38         */
39        TarEntry(String name, int pos) {
40                this.name = name;
41                mode = 0644;
42                type = FILE;
43                filepos = pos;
44                time = System.currentTimeMillis() / 1000;
45        }
46 
47        /**
48         * Create a new TarEntry for a file of the given name.
49         * 
50         * @param name filename
51         */
52        public TarEntry(String name) {
53                this(name, -1);
54        }
55 
56        /* (non-Javadoc)
57         * @see java.lang.Object#clone()
58         */
59        public Object clone() {
60                TarEntry entry = new TarEntry(this.name, this.filepos);
61                entry.setFileType(this.type);
62                entry.setMode(this.mode);
63                entry.setSize(this.size);
64                entry.setTime(this.time);
65                return entry;
66        }
67 
68        /**
69         * Returns the type of this file, one of FILE, LINK, SYM_LINK,
70         * CHAR_DEVICE, BLOCK_DEVICE, DIRECTORY or FIFO.
71         * 
72         * @return file type
73         */
74        public int getFileType() {
75                return type;
76        }
77 
78        /**
79         * Returns the mode of the file in UNIX permissions format.
80         * 
81         * @return file mode
82         */
83        public long getMode() {
84                return mode;
85        }
86 
87        /**
88         * Returns the name of the file.
89         * 
90         * @return filename
91         */
92        public String getName() {
93                return name;
94        }
95 
96        /**
97         * Returns the size of the file in bytes.
98         * 
99         * @return size
100         */
101        public long getSize() {
102                return size;
103        }
104 
105        /**
106         * Returns the modification time of the file in seconds since January
107         * 1st 1970.
108         * 
109         * @return time
110         */
111        public long getTime() {
112                return time;
113        }
114 
115        /**
116         * Sets the type of the file, one of FILE, LINK, SYMLINK, CHAR_DEVICE,
117         * BLOCK_DEVICE, or DIRECTORY.
118         * 
119         * @param type
120         */
121        public void setFileType(int type) {
122                this.type = type;
123        }
124 
125        /**
126         * Sets the mode of the file in UNIX permissions format.
127         * 
128         * @param mode
129         */
130        public void setMode(long mode) {
131                this.mode = mode;
132        }
133 
134        /**
135         * Sets the size of the file in bytes.
136         * 
137         * @param size
138         */
139        public void setSize(long size) {
140                this.size = size;
141        }
142 
143        /**
144         * Sets the modification time of the file in seconds since January
145         * 1st 1970.
146         * 
147         * @param time
148         */
149        public void setTime(long time) {
150                this.time = time;
151        }
152        public String toString() {
153                return this.getName();
154        }
155}

[all classes][org.eclipse.pde.api.tools.internal.util]
EMMA 2.0.5312 EclEmma Fix 1 (C) Vladimir Roubtsov