FileDocCategorySizeDatePackage
StringConstant.javaAPI DocphoneME MR2 API (J2ME)2975Wed May 02 17:59:48 BST 2007components

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 );
	}