1 28 29 package com.caucho.bytecode; 30 31 import com.caucho.log.Log; 32 33 import java.io.IOException ; 34 import java.util.logging.Logger ; 35 36 39 public class StringConstant extends ConstantPoolEntry { 40 static private final Logger log = Log.open(StringConstant.class); 41 42 private int _stringIndex; 43 44 47 StringConstant(ConstantPool pool, int index, int stringIndex) 48 { 49 super(pool, index); 50 51 _stringIndex = stringIndex; 52 } 53 54 57 public String getString() 58 { 59 return getConstantPool().getUtf8(_stringIndex).getValue(); 60 } 61 62 65 void write(ByteCodeWriter out) 66 throws IOException 67 { 68 out.write(ConstantPool.CP_STRING); 69 out.writeShort(_stringIndex); 70 } 71 72 75 public int export(ConstantPool target) 76 { 77 return target.addString(getString()).getIndex(); 78 } 79 80 public String toString() 81 { 82 return "StringConstant[" + getString() + "]"; 83 } 84 } 85 | Popular Tags |