1 23 24 25 package com.sun.jdo.api.persistence.enhancer.classfile; 26 27 import java.io.*; 28 29 32 33 40 41 public class ConstString extends ConstValue { 42 43 public static final int MyTag = CONSTANTString; 44 45 46 private ConstUtf8 stringValue; 47 48 50 private int stringValueIndex; 51 52 53 54 57 public int tag () { return MyTag; } 58 59 62 public ConstUtf8 value() { 63 return stringValue; 64 } 65 66 69 public String descriptor() { 70 return "Ljava/lang/String;"; } 72 73 76 public String toString () { 77 return "CONSTANTString(" + indexAsString() + "): " + "string(" + stringValue.asString() + ")"; } 80 81 82 83 ConstString (ConstUtf8 s) { 84 stringValue = s; 85 } 86 87 ConstString (int sIndex) { 88 stringValueIndex = sIndex; 89 } 90 91 void formatData (DataOutputStream b) throws IOException { 92 b.writeShort (stringValue.getIndex()); 93 } 94 static ConstString read (DataInputStream input) throws IOException { 95 return new ConstString (input.readUnsignedShort()); 96 } 97 void resolve (ConstantPool p) { 98 stringValue = (ConstUtf8) p.constantAt(stringValueIndex); 99 } 100 } 101 102 103 | Popular Tags |