FileDocCategorySizeDatePackage
StringConstant.javaAPI DocJ2ME CLDC 1.12202Wed Feb 05 15:56:02 GMT 2003components

StringConstant

public class StringConstant extends ConstantObject

Fields Summary
public UnicodeConstant
str
public int
strIndex
public int
unicodeIndex
public int
unicodeOffset
public boolean
dataWritten
public boolean
handleWritten
Constructors Summary
private StringConstant(int t, int i)


          
    tag = t;
    strIndex = i;
    nSlots = 1;
    
Methods Summary
public voiddecReference()

    references--;
    str.decReference();
    
public booleanequals(java.lang.Object o)

    if (o instanceof StringConstant) {
        StringConstant s = (StringConstant) o;
        return str.string.equals(s.str.string);
    } else {
        return false;
    }
    
public voidexternalize(ConstantPool p)

    str = (UnicodeConstant)p.add( str );
    
public inthashCode()

    return tag + str.string.hashCode();
    
public voidincReference()

    references++;
    str.incReference();
    
public booleanisResolved()

 return true; 
public static ConstantObjectread(int t, java.io.DataInput i)

    return new StringConstant( t, i.readUnsignedShort() );
    
public voidresolve(ConstantObject[] table)

    if (resolved) return;
    str = (UnicodeConstant)table[strIndex];
    resolved = true;
    
public java.lang.StringtoString()

    return "String: "+ ((resolved)?str.string:("[ "+strIndex+" ]"));
    
public voidwrite(java.io.DataOutput o)

    o.writeByte( tag );
    if ( resolved ){
        o.writeShort( str.index );
    } else {
        throw new DataFormatException("unresolved StringConstant");
        //o.writeShort( strIndex );
    }