1 16 17 package org.cojen.classfile.constant; 18 19 import java.io.DataOutput ; 20 import java.io.IOException ; 21 import org.cojen.classfile.ConstantInfo; 22 import org.cojen.classfile.ConstantPool; 23 24 30 public class ConstantUTFInfo extends ConstantInfo { 31 private final String mStr; 32 33 public ConstantUTFInfo(String str) { 34 super(TAG_UTF8); 35 mStr = str; 36 } 37 38 public String getValue() { 39 return mStr; 40 } 41 42 public int hashCode() { 43 return mStr.hashCode(); 44 } 45 46 public boolean equals(Object obj) { 47 if (obj instanceof ConstantUTFInfo) { 48 ConstantUTFInfo other = (ConstantUTFInfo)obj; 49 return mStr.equals(other.mStr); 50 } 51 52 return false; 53 } 54 55 public void writeTo(DataOutput dout) throws IOException { 56 super.writeTo(dout); 57 dout.writeUTF(mStr); 58 } 59 60 public String toString() { 61 return "CONSTANT_Utf8_info: " + getValue(); 62 } 63 } 64 | Popular Tags |