home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 1999 March / maximum-cd-1999-03.iso / Feature / Lotus / ORGANIZE / COMPNENT / LTOUIN21.ZIP / sunw / demo / classfile / StringConstant.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-03-12  |  1.3 KB  |  38 lines

  1. package sunw.demo.classfile;
  2.  
  3. import java.io.DataOutputStream;
  4. import java.io.IOException;
  5.  
  6. final class StringConstant extends ConstantPoolEntry {
  7.    private UTF8Constant string;
  8.  
  9.    StringConstant(String var1, ClassFile var2) {
  10.       super((byte)8, var2);
  11.       this.string = var2.addUTF8Constant(var1);
  12.       ((ConstantPoolEntry)this).addToConstantPool();
  13.    }
  14.  
  15.    StringConstant(UTF8Constant var1, ClassFile var2) {
  16.       super((byte)8, var2);
  17.       this.string = var1;
  18.       ((ConstantPoolEntry)this).addToConstantPool();
  19.    }
  20.  
  21.    public boolean equals(Object var1) {
  22.       return var1 instanceof StringConstant ? this.string.equals(((StringConstant)var1).string) : false;
  23.    }
  24.  
  25.    String getString() {
  26.       return this.string.getString();
  27.    }
  28.  
  29.    public int hashCode() {
  30.       return this.string.hashCode();
  31.    }
  32.  
  33.    void write(DataOutputStream var1) throws IOException {
  34.       var1.writeByte(((ConstantPoolEntry)this).getTag());
  35.       var1.writeShort(this.string.getConstantPoolIndex());
  36.    }
  37. }
  38.