KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > gjt > jclasslib > structures > attributes > LocalVariableTableEntry


1 /*
2     This library is free software; you can redistribute it and/or
3     modify it under the terms of the GNU General Public
4     License as published by the Free Software Foundation; either
5     version 2 of the license, or (at your option) any later version.
6 */

7
8 package org.gjt.jclasslib.structures.attributes;
9
10 import org.gjt.jclasslib.structures.ClassFile;
11 import org.gjt.jclasslib.structures.InvalidByteCodeException;
12
13 import java.io.DataInput JavaDoc;
14 import java.io.IOException JavaDoc;
15
16 /**
17  * Describes an entry in a <tt>LocalVariableTableEntry</tt> attribute structure.
18  *
19  * @author <a HREF="mailto:jclasslib@ej-technologies.com">Ingo Kegel</a>, <a HREF="mailto:vitor.carreira@gmail.com">Vitor Carreira</a>
20  * @version $Revision: 1.4 $ $Date: 2004/12/28 13:04:32 $
21  */

22 public class LocalVariableTableEntry extends LocalVariableCommonEntry {
23     /**
24      * Factory method for creating <tt>LocalVariableTableEntry</tt> structures.
25      *
26      * @param in the <tt>DataInput</tt> from which to read the
27      * <tt>LocalVariableTableEntry</tt> structure
28      * @param classFile the parent class file of the structure to be created
29      * @return the new <tt>LocalVariableTableEntry</tt> structure
30      * @throws InvalidByteCodeException if the byte code is invalid
31      * @throws IOException if an exception occurs with the <tt>DataInput</tt>
32      */

33     public static LocalVariableTableEntry create(DataInput JavaDoc in, ClassFile classFile)
34             throws InvalidByteCodeException, IOException JavaDoc {
35
36         LocalVariableTableEntry localVariableTableEntry = new LocalVariableTableEntry();
37         localVariableTableEntry.setClassFile(classFile);
38         localVariableTableEntry.read(in);
39
40         return localVariableTableEntry;
41     }
42
43
44     /**
45      * Get the index of the constant pool entry containing the descriptor of this
46      * local variable.
47      *
48      * @return the index
49      */

50     public int getDescriptorIndex() {
51         return descriptorOrSignatureIndex;
52     }
53
54     /**
55      * Get the index of the constant pool entry containing the descriptor of this
56      * local variable.
57      *
58      * @param descriptorIndex the index
59      */

60     public void setDescriptorIndex(int descriptorIndex) {
61         setDescriptorOrSignatureIndex(descriptorIndex);
62     }
63
64
65     protected void debug(String JavaDoc message) {
66         super.debug(message + "LocalVariableTable entry with start_pc " +
67                 startPc + ", length " + length + ", name_index " + nameIndex +
68                 ", descriptor_index " + descriptorOrSignatureIndex + ", index " + index);
69     }
70 }
71
Popular Tags