1 package net.sf.jour.processor;
2
3 import java.io.File;
4 import java.io.FileInputStream;
5 import java.io.IOException;
6 import java.io.InputStream;
7
8 public class FileEntry implements Entry {
9
10 private File file;
11
12 private String name;
13
14 public FileEntry(File file, String baseName) {
15 this.file = file;
16 name = file.getAbsolutePath().substring(baseName.length() + 1).replace('\\', '/');
17 }
18
19 public InputStream getInputStream() throws IOException {
20 return new FileInputStream(file);
21 }
22
23 public Entry getOrigin() {
24 return this;
25 }
26
27 public String getName() {
28 return name;
29 }
30
31 public long getSize() {
32 return file.length();
33 }
34
35 public long getTime() {
36 return file.lastModified();
37 }
38
39 public boolean isClass() {
40 return file.getName().endsWith(".class");
41 }
42
43 public boolean isDirectory() {
44 return file.isDirectory();
45 }
46
47 public boolean equals(Object o) {
48 if ((o == null) || (!(o instanceof FileEntry))) {
49 return false;
50 }
51 return file.equals(((FileEntry)o).file);
52 }
53
54 }