1 7 package org.gjt.jclasslib.structures.elementvalues; 8 9 import org.gjt.jclasslib.structures.InvalidByteCodeException; 10 11 import java.io.*; 12 13 19 public class ConstElementValue extends ElementValue { 20 21 public final static String ENTRY_NAME = "ConstElement"; 22 23 private static final int LENGTH = 2; 24 private int constValueIndex; 25 26 protected ConstElementValue(int tag) { 27 super(tag); 28 } 29 30 35 public int getConstValueIndex() { 36 return this.constValueIndex; 37 } 38 39 44 public void setConstValueIndex(int constValueIndex) { 45 this.constValueIndex = constValueIndex; 46 } 47 48 protected int getSpecificLength() { 49 return LENGTH; 50 } 51 52 public void read(DataInput in) throws InvalidByteCodeException, IOException { 53 super.read(in); 54 55 constValueIndex = in.readUnsignedShort(); 56 57 if (debug) debug("read "); 58 } 59 60 public void write(DataOutput out) throws InvalidByteCodeException, IOException { 61 super.write(out); 62 63 out.writeShort(constValueIndex); 64 65 if (debug) debug("wrote "); 66 } 67 68 protected void debug(String message) { 69 super.debug(message + 70 "ConstElementValue with const_value_index " + 71 constValueIndex); 72 } 73 74 public String getEntryName() { 75 return ENTRY_NAME; 76 } 77 } 78 | Popular Tags |