1 25 26 package org.netbeans.modules.classfile; 27 28 import java.io.DataInputStream ; 29 import java.io.IOException ; 30 31 36 public final class LocalVariableTableEntry { 37 38 int startPC; 39 int length; 40 String name; 41 String description; 42 int index; 43 44 static LocalVariableTableEntry[] loadLocalVariableTable(DataInputStream in, ConstantPool pool) 45 throws IOException { 46 int n = in.readUnsignedShort(); 47 LocalVariableTableEntry[] entries = new LocalVariableTableEntry[n]; 48 for (int i = 0; i < n; i++) 49 entries[i] = new LocalVariableTableEntry(in, pool); 50 return entries; 51 } 52 53 54 LocalVariableTableEntry(DataInputStream in, ConstantPool pool) 55 throws IOException { 56 loadLocalVariableEntry(in, pool); 57 } 58 59 private void loadLocalVariableEntry(DataInputStream in, ConstantPool pool) 60 throws IOException { 61 startPC = in.readUnsignedShort(); 62 length = in.readUnsignedShort(); 63 Object o = pool.get(in.readUnsignedShort()); 64 if (!(o instanceof CPUTF8Info)) 65 throw new InvalidClassFormatException(); 66 CPUTF8Info entry = (CPUTF8Info)o; 67 name = entry.getName(); 68 o = pool.get(in.readUnsignedShort()); 69 if (!(o instanceof CPUTF8Info)) 70 throw new InvalidClassFormatException(); 71 entry = (CPUTF8Info)o; 72 description = entry.getName(); 73 index = in.readUnsignedShort(); 74 } 75 76 79 public final int getStartPC() { 80 return startPC; 81 } 82 83 87 public final int getLength() { 88 return length; 89 } 90 91 94 public final String getName() { 95 return name; 96 } 97 98 101 public final String getDescription() { 102 return description; 103 } 104 105 109 public final int getIndex() { 110 return index; 111 } 112 } 113 | Popular Tags |