| Home >> All >> com >> techtrader >> modules >> tools >> bytecode >> [ lowlevel Javadoc ] |
Source code: com/techtrader/modules/tools/bytecode/lowlevel/StringEntry.java
1 package com.techtrader.modules.tools.bytecode.lowlevel; 2 3 4 import java.io.DataInput; 5 import java.io.DataOutput; 6 import java.io.IOException; 7 import java.io.PrintWriter; 8 9 import com.techtrader.modules.tools.bytecode.visitor.BCVisitor; 10 11 12 /** 13 * String constant constant pool entry. 14 * 15 * @author Abe White 16 */ 17 public class StringEntry 18 implements ConstantEntry, LowLevelConstants 19 { 20 private int _stringIndex = -1; 21 22 23 public int getType () 24 { 25 return ENTRY_STRING; 26 } 27 28 29 /** 30 * Get the index into the constant pool of the UTF8Entry storing the 31 * value of this string constant. 32 */ 33 public int getStringIndex () 34 { 35 return _stringIndex; 36 } 37 38 39 /** 40 * Set the index into the constant pool of the UTF8Entry storing the 41 * value of this string constant. 42 */ 43 public void setStringIndex (int stringIndex) 44 { 45 _stringIndex = stringIndex; 46 } 47 48 49 public Object getConstantValue () 50 { 51 return new Integer (_stringIndex); 52 } 53 54 55 public void setConstantValue (Object val) 56 { 57 _stringIndex = ((Number) val).intValue (); 58 } 59 60 61 public void readData (DataInput in) 62 throws IOException 63 { 64 setStringIndex (in.readUnsignedShort ()); 65 } 66 67 68 public void writeData (DataOutput out) 69 throws IOException 70 { 71 out.writeShort (getStringIndex ()); 72 } 73 74 75 public String getKey () 76 { 77 return getType () + "|" + getStringIndex (); 78 } 79 80 81 public void acceptVisit (BCVisitor visit) 82 { 83 visit.enterStringEntry (this); 84 visit.exitStringEntry (this); 85 } 86 }