KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > umd > cs > findbugs > classfile > impl > SingleFileCodeBaseEntry


1 package edu.umd.cs.findbugs.classfile.impl;
2
3 import java.io.IOException JavaDoc;
4 import java.io.InputStream JavaDoc;
5
6 import edu.umd.cs.findbugs.classfile.ClassDescriptor;
7 import edu.umd.cs.findbugs.classfile.ICodeBase;
8 import edu.umd.cs.findbugs.classfile.ICodeBaseEntry;
9 import edu.umd.cs.findbugs.classfile.InvalidClassFileFormatException;
10 import edu.umd.cs.findbugs.classfile.ResourceNotFoundException;
11
12 /**
13  * Codebase entry for a single-file codebase.
14  *
15  * @author David Hovemeyer
16  */

17 public class SingleFileCodeBaseEntry implements ICodeBaseEntry {
18     private final SingleFileCodeBase codeBase;
19
20     /**
21      * Constructor.
22      *
23      * @param codeBase parent codebase
24      */

25     public SingleFileCodeBaseEntry(SingleFileCodeBase codeBase) {
26         this.codeBase = codeBase;
27     }
28
29     /* (non-Javadoc)
30      * @see edu.umd.cs.findbugs.classfile.ICodeBaseEntry#getNumBytes()
31      */

32     public int getNumBytes() {
33         return codeBase.getNumBytes();
34     }
35
36     /* (non-Javadoc)
37      * @see edu.umd.cs.findbugs.classfile.ICodeBaseEntry#getResourceName()
38      */

39     public String JavaDoc getResourceName() {
40         return codeBase.getResourceName();
41     }
42
43     /* (non-Javadoc)
44      * @see edu.umd.cs.findbugs.classfile.ICodeBaseEntry#openResource()
45      */

46     public InputStream JavaDoc openResource() throws IOException JavaDoc {
47         return codeBase.openFile();
48     }
49     
50     /* (non-Javadoc)
51      * @see edu.umd.cs.findbugs.classfile.ICodeBaseEntry#getCodeBase()
52      */

53     public ICodeBase getCodeBase() {
54         return codeBase;
55     }
56     
57     /* (non-Javadoc)
58      * @see edu.umd.cs.findbugs.classfile.ICodeBaseEntry#getClassDescriptor()
59      */

60     public ClassDescriptor getClassDescriptor() throws ResourceNotFoundException, InvalidClassFileFormatException {
61         return codeBase.getClassDescriptor();
62     }
63     
64     /* (non-Javadoc)
65      * @see edu.umd.cs.findbugs.classfile.ICodeBaseEntry#overrideResourceName(java.lang.String)
66      */

67     public void overrideResourceName(String JavaDoc resourceName) {
68         // FIXME: implement this
69
}
70     
71     /* (non-Javadoc)
72      * @see java.lang.Object#equals(java.lang.Object)
73      */

74     @Override JavaDoc
75     public boolean equals(Object JavaDoc obj) {
76         if (obj == null || obj.getClass() != this.getClass()) {
77             return false;
78         }
79         SingleFileCodeBaseEntry other = (SingleFileCodeBaseEntry) obj;
80         return other.codeBase.equals(this.codeBase);
81     }
82     
83     /* (non-Javadoc)
84      * @see java.lang.Object#hashCode()
85      */

86     @Override JavaDoc
87     public int hashCode() {
88         return codeBase.hashCode();
89     }
90     
91     /* (non-Javadoc)
92      * @see java.lang.Object#toString()
93      */

94     @Override JavaDoc
95     public String JavaDoc toString() {
96         return codeBase.getPathName();
97     }
98 }
99
Popular Tags