opu.lljvm-python.0.2.0-EXPERIMENTAL.source-code.StringCP Maven / Gradle / Ivy
The newest version!
package jas;
import java.io.*;
/**
* Wrap an String constant reference with this CPE.
*
* @author $Author: jonmeyerny $
* @version $Revision: 1.1 $
*/
public class StringCP extends CP implements RuntimeConstants
{
AsciiCP val;
/**
* @param s Value for String constant
*/
public StringCP(String s)
{
uniq = ("String: @#$" + s).intern();
val = new AsciiCP(s);
}
void resolve(ClassEnv e) { e.addCPItem(val); }
void write(ClassEnv e, DataOutputStream out)
throws IOException, jasError
{
out.writeByte(CONSTANT_STRING);
out.writeShort(e.getCPIndex(val));
}
}