constantfloatinfo.java

来自「本人根据自己的实际情况」· Java 代码 · 共 47 行

JAVA
47
字号
/**
 *
 */
package gen.info.constant;

import gen.ClassFile;
import java.io.DataOutputStream;
import java.io.IOException;

/**
 * @author liuyi
 *
 */
public class ConstantFloatInfo extends CpInfo {
    
    private int bytes;
    
    /**
     * @param tag
     */
    public ConstantFloatInfo(int bytes, ClassFile classFile) {
        super(CONSTANT_Float, classFile);
        this.bytes = bytes;
    }
    
    public ConstantFloatInfo(float value, ClassFile classFile){
        this(Float.floatToIntBits(value), classFile);
    }
    
    public int getBytes(){
        return bytes;
    }
    
    public String getRefString(){
        return "float\t" + String.valueOf(Float.intBitsToFloat(bytes));
    }
    
    public String toString(){
        return "const #" + index + " = " + getRefString();
    }

    public void toBinary(DataOutputStream writer) throws IOException{
        writer.writeByte(tag);
        writer.writeInt(bytes);
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?