KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sli > kim > classfile > CodeInfo


1 package sli.kim.classfile;
2
3 import java.util.Vector JavaDoc;
4
5 /**
6 * A class for storing information about the code of a method.
7 *
8 * @see sli.kim.classfile.MethodInfo#setCodeInfo()
9 */

10 public class CodeInfo {
11     private short maxStack, maxLocals;
12     private byte[] bytecode;
13     private ExceptionInfo[] exceptionTable;
14     private LineNumberInfo[] lineNumberTable;
15     private LocalVariableInfo[] localVariableTable;
16     private Vector JavaDoc attributes = new Vector JavaDoc();
17
18     public CodeInfo(short maxStack, short maxLocals, byte[] bytecode,
19         ExceptionInfo[] exceptionTable)
20     {
21         setMaxStack(maxStack);
22         setMaxLocals(maxLocals);
23         setBytecode(bytecode);
24         setExceptionTable(exceptionTable);
25     }
26
27     public void setMaxStack(short maxStack) {
28         this.maxStack = maxStack;
29     }
30
31     public short getMaxStack() {
32         return maxStack;
33     }
34
35     public void setMaxLocals(short maxLocals) {
36         this.maxLocals = maxLocals;
37     }
38
39     public short getMaxLocals() {
40         return maxLocals;
41     }
42
43     public void setBytecode(byte[] bytecode) {
44         this.bytecode = bytecode;
45     }
46
47     public byte[] getBytecode() {
48         return bytecode;
49     }
50
51     public void setExceptionTable(ExceptionInfo[] exceptionTable) {
52         this.exceptionTable = exceptionTable;
53     }
54
55     public ExceptionInfo[] getExceptionTable() {
56         return exceptionTable;
57     }
58
59     public void setLineNumberTable(LineNumberInfo[] lineNumberTable) {
60         this.lineNumberTable = lineNumberTable;
61     }
62
63     public LineNumberInfo[] getLineNumberTable() {
64         return lineNumberTable;
65     }
66
67     public void setLocalVariableTable(LocalVariableInfo[] localVariableTable) {
68         this.localVariableTable = localVariableTable;
69     }
70
71     public LocalVariableInfo[] getLocalVariableTable() {
72         return localVariableTable;
73     }
74
75     public void addAttribute(AttributeInfo attributeInfo) {
76         attributes.addElement(attributeInfo);
77     }
78
79     public AttributeInfo[] getAttributes() {
80         AttributeInfo[] list = new AttributeInfo[attributes.size()];
81         attributes.copyInto(list);
82         return list;
83     }
84 }
Popular Tags