KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > umd > cs > findbugs > classfile > ICodeBaseEntry


1 /*
2  * FindBugs - Find Bugs in Java programs
3  * Copyright (C) 2006, University of Maryland
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19
20 package edu.umd.cs.findbugs.classfile;
21
22 import java.io.IOException JavaDoc;
23 import java.io.InputStream JavaDoc;
24
25 /**
26  * Object representing a resource in a code base.
27  *
28  * @author David Hovemeyer
29  */

30 public interface ICodeBaseEntry {
31     /**
32      * Get the name of the resource.
33      *
34      * @return the name of the resource
35      */

36     public String JavaDoc getResourceName();
37     
38     /**
39      * Get the number of bytes in the resource.
40      * Returns <0 if the number of bytes is not known.
41      *
42      * @return number of bytes in the resource, or <0 if not known.
43      */

44     public int getNumBytes();
45
46     /**
47      * Open an input stream reading from the resource.
48      *
49      * @return InputStream reading from the resource.
50      * @throws IOException if an error occurs reading from the resource
51      */

52     public InputStream JavaDoc openResource() throws IOException JavaDoc;
53     
54     /**
55      * Get the codebase this codebase entry belongs to.
56      *
57      * @return the codebase this codebase entry belongs to
58      */

59     public ICodeBase getCodeBase();
60
61     /**
62      * Return the ClassDescriptor of the class resource accessed
63      * by this codebase entry. Do not call this method unless
64      * ClassDescriptor.isClassResource() returns true.
65      * This method may require the class data to be loaded
66      * in order to determine the class.
67      *
68      * @return ClassDescriptor of this entry
69      * @throws CheckedAnalysisException if the codebase entry does not reference a valid classfile
70      * @throws IllegalArgumentException if the codebase entry's filename is definitely not a classfile
71      */

72     public ClassDescriptor getClassDescriptor() throws ResourceNotFoundException, InvalidClassFileFormatException;
73
74     /**
75      * Override the resource name of this codebase entry.
76      *
77      * @param resourceName the new resource name
78      */

79     public void overrideResourceName(String JavaDoc resourceName);
80 }
81
Popular Tags