1 52 53 package com.go.trove.classfile; 54 55 import java.io.*; 56 57 65 public class ConstantUTFInfo extends ConstantInfo { 66 private String mStr; 67 68 73 static ConstantUTFInfo make(ConstantPool cp, String str) { 74 ConstantInfo ci = new ConstantUTFInfo(str); 75 return (ConstantUTFInfo)cp.addConstant(ci); 76 } 77 78 ConstantUTFInfo(String str) { 79 super(TAG_UTF8); 80 mStr = str; 81 } 82 83 public String getValue() { 84 return mStr; 85 } 86 87 public int hashCode() { 88 return mStr.hashCode(); 89 } 90 91 public boolean equals(Object obj) { 92 if (obj instanceof ConstantUTFInfo) { 93 ConstantUTFInfo other = (ConstantUTFInfo)obj; 94 return mStr.equals(other.mStr); 95 } 96 97 return false; 98 } 99 100 public void writeTo(DataOutput dout) throws IOException { 101 super.writeTo(dout); 102 dout.writeUTF(mStr); 103 } 104 105 public String toString() { 106 return "CONSTANT_Utf8_info: " + getValue(); 107 } 108 } 109 | Popular Tags |