1 32 33 package com.jeantessier.classreader; 34 35 import java.io.*; 36 import java.util.*; 37 38 import org.apache.log4j.*; 39 40 public class LocalVariableTable_attribute extends Attribute_info { 41 private Collection localVariables = new LinkedList(); 42 43 public LocalVariableTable_attribute(Classfile classfile, Visitable owner, DataInputStream in) throws IOException { 44 super(classfile, owner); 45 46 int byteCount = in.readInt(); 47 Logger.getLogger(getClass()).debug("Attribute length: " + byteCount); 48 49 int localVariableTableLength = in.readUnsignedShort(); 50 Logger.getLogger(getClass()).debug("Reading " + localVariableTableLength + " local variable(s) ..."); 51 for (int i=0; i<localVariableTableLength; i++) { 52 Logger.getLogger(getClass()).debug("Local variable " + i + ":"); 53 localVariables.add(new LocalVariable(this, in)); 54 } 55 } 56 57 public Collection getLocalVariables() { 58 return localVariables; 59 } 60 61 public String toString() { 62 return "Local Variable Table"; 63 } 64 65 public void accept(Visitor visitor) { 66 visitor.visitLocalVariableTable_attribute(this); 67 } 68 } 69 | Popular Tags |