1 30 31 55 package jbet; 56 import java.io.*; 57 58 class CpUtf8 extends CpEntry { 59 String string; 60 61 CpUtf8(int i, CPInterface cp) { 62 super(i, CPInterface.CONSTANT_Utf8, cp); 63 } 64 65 CpUtf8(CPInterface cp, String s) { 66 super(cp.poolCount(), CPInterface.CONSTANT_Utf8, cp); 67 string = s; 68 } 69 70 public String toString() { 71 return "\"" + Util.quoteString(string) + "\"" ; 72 } 73 74 public int hashCode() { 75 return string.hashCode(); 76 } 77 78 public boolean equals(Object o) { 79 return (o instanceof CpUtf8) && ((CpUtf8)o).string.equals(string); 80 } 81 82 83 void write(DataOutputStream dataOut) throws IOException { 84 dataOut.writeByte(tag); 85 dataOut.writeUTF(string); 86 } 87 88 } 89 90 91 92 | Popular Tags |