1 7 8 package org.gjt.jclasslib.structures.attributes; 9 10 import org.gjt.jclasslib.structures.InvalidByteCodeException; 11 12 import java.io.DataInput ; 13 import java.io.IOException ; 14 15 21 public class LocalVariableTableAttribute extends LocalVariableCommonAttribute { 22 23 26 public static final String ATTRIBUTE_NAME = "LocalVariableTable"; 27 28 34 public LocalVariableTableEntry[] getLocalVariableTable() { 35 return (LocalVariableTableEntry[])localVariableTable; 36 } 37 38 44 public void setLocalVariableTable(LocalVariableTableEntry[] localVariableTable) { 45 this.localVariableTable = localVariableTable; 46 } 47 48 public void read(DataInput in) 49 throws InvalidByteCodeException, IOException { 50 super.read(in); 51 52 int localVariableTableLength = in.readUnsignedShort(); 53 localVariableTable = new LocalVariableTableEntry[localVariableTableLength]; 54 for (int i = 0; i < localVariableTableLength; i++) { 55 localVariableTable[i] = LocalVariableTableEntry.create(in, classFile); 56 } 57 58 if (debug) debug("read "); 59 } 60 61 public int getAttributeLength() { 62 return INITIAL_LENGTH + getLength(localVariableTable) * LocalVariableTableEntry.LENGTH; 63 } 64 65 66 protected void debug(String message) { 67 super.debug(message + "LocalVariableTable attribute with " + getLength(localVariableTable) + " entries"); 68 } 69 70 } 71 | Popular Tags |