KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > umd > cs > findbugs > classfile > analysis > ClassData


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.analysis;
21
22 import java.io.ByteArrayInputStream JavaDoc;
23 import java.io.InputStream JavaDoc;
24
25 import edu.umd.cs.findbugs.classfile.ClassDescriptor;
26 import edu.umd.cs.findbugs.classfile.ICodeBaseEntry;
27
28 /**
29  * The data (bytes) of a class.
30  *
31  * @author David Hovemeyer
32  */

33 public class ClassData {
34     private final ClassDescriptor classDescriptor;
35     private final ICodeBaseEntry codeBaseEntry;
36     private final byte[] data;
37     
38     /**
39      * Constructor.
40      *
41      * @param classDescriptor descriptor for the class
42      * @param data the data (bytes) for a class
43      */

44     public ClassData(ClassDescriptor classDescriptor, ICodeBaseEntry codeBaseEntry, byte[] data) {
45         this.classDescriptor = classDescriptor;
46         this.codeBaseEntry = codeBaseEntry;
47         this.data = data;
48     }
49     
50     /**
51      * @return Returns the ClassDescriptor.
52      */

53     public ClassDescriptor getClassDescriptor() {
54         return classDescriptor;
55     }
56     
57     /**
58      * @return Returns the codeBaseEntry.
59      */

60     public ICodeBaseEntry getCodeBaseEntry() {
61         return codeBaseEntry;
62     }
63     
64     /**
65      * @return Returns the data.
66      */

67     public byte[] getData() {
68         return data;
69     }
70
71     /**
72      * Open an InputStream on the class data.
73      *
74      * @return InputStream reading from the class data
75      */

76     public InputStream JavaDoc getInputStream() {
77         return new ByteArrayInputStream JavaDoc(data);
78     }
79
80 }
81
Popular Tags