1 7 package org.gjt.jclasslib.structures.attributes; 8 9 import org.gjt.jclasslib.structures.AbstractStructure; 10 import org.gjt.jclasslib.structures.InvalidByteCodeException; 11 12 import java.io.*; 13 14 20 public abstract class LocalVariableCommonEntry extends AbstractStructure { 21 24 public static final int LENGTH = 10; 25 26 protected int startPc; 27 protected int length; 28 protected int nameIndex; 29 protected int descriptorOrSignatureIndex; 30 protected int index; 31 32 37 final public int getStartPc() { 38 return startPc; 39 } 40 41 46 final public void setStartPc(int startPc) { 47 this.startPc = startPc; 48 } 49 50 55 final public int getLength() { 56 return length; 57 } 58 59 64 final public void setLength(int length) { 65 this.length = length; 66 } 67 68 74 final public int getNameIndex() { 75 return nameIndex; 76 } 77 78 84 final public void setNameIndex(int nameIndex) { 85 this.nameIndex = nameIndex; 86 } 87 88 94 final public int getDescriptorOrSignatureIndex() { 95 return descriptorOrSignatureIndex; 96 } 97 98 104 final public void setDescriptorOrSignatureIndex(int descriptorIndex) { 105 this.descriptorOrSignatureIndex = descriptorIndex; 106 } 107 108 113 final public int getIndex() { 114 return index; 115 } 116 117 121 final public void setIndex(int index) { 122 this.index = index; 123 } 124 125 final public void read(DataInput in) 126 throws InvalidByteCodeException, IOException { 127 super.read(in); 128 129 startPc = in.readUnsignedShort(); 130 length = in.readUnsignedShort(); 131 nameIndex = in.readUnsignedShort(); 132 descriptorOrSignatureIndex = in.readUnsignedShort(); 133 index = in.readUnsignedShort(); 134 135 if (debug) debug("read "); 136 } 137 138 final public void write(DataOutput out) 139 throws InvalidByteCodeException, IOException { 140 super.write(out); 141 142 out.writeShort(startPc); 143 out.writeShort(length); 144 out.writeShort(nameIndex); 145 out.writeShort(descriptorOrSignatureIndex); 146 out.writeShort(index); 147 148 if (debug) debug("wrote "); 149 } 150 151 protected String printAccessFlagsVerbose(int accessFlags) { 152 if (accessFlags != 0) 153 throw new RuntimeException ("Access flags should be zero: " + 154 Integer.toHexString(accessFlags)); 155 return ""; 156 } 157 } 158 | Popular Tags |