1 7 8 package org.gjt.jclasslib.structures.attributes; 9 10 import org.gjt.jclasslib.structures.AttributeInfo; 11 import org.gjt.jclasslib.structures.InvalidByteCodeException; 12 13 import java.io.*; 14 15 21 public class ConstantValueAttribute extends AttributeInfo { 22 23 24 public static final String ATTRIBUTE_NAME = "ConstantValue"; 25 26 private static final int LENGTH = 2; 27 28 private int constantvalueIndex; 29 30 34 public int getConstantvalueIndex() { 35 return constantvalueIndex; 36 } 37 38 42 public void setConstantvalueIndex(int constantvalueIndex) { 43 this.constantvalueIndex = constantvalueIndex; 44 } 45 46 public void read(DataInput in) 47 throws InvalidByteCodeException, IOException { 48 49 constantvalueIndex = in.readUnsignedShort(); 50 if (debug) debug("read "); 51 } 52 53 public void write(DataOutput out) 54 throws InvalidByteCodeException, IOException { 55 56 super.write(out); 57 out.writeShort(constantvalueIndex); 58 if (debug) debug("wrote "); 59 } 60 61 public int getAttributeLength() { 62 return LENGTH; 63 } 64 65 protected void debug(String message) { 66 super.debug(message + "ConstantValue attribute with constantvalue_index " + constantvalueIndex); 67 } 68 69 } 70 | Popular Tags |