⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 constantutf8info.java

📁 本人根据自己的实际情况
💻 JAVA
字号:
/**
 *
 */
package gen.info.constant;

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

/**
 * @author liuyi
 *
 */
public class ConstantUtf8Info extends CpInfo {
    
    /** string with Utf8 encoding */
    private byte[] bytes;
    
    /**
     * @param tag
     */
    public ConstantUtf8Info(byte[] bytes, ClassFile classFile) {
        super(CONSTANT_Utf8, classFile);
        
        this.bytes = bytes;
    }
    
    public byte[] getBytes(){
        return bytes;
    }
    
    public String getRefString(){
        return new String(bytes);
    }
    
    public String toString(){
        return "const #" + index + " = Asciz\t" + getRefString();
    }
    
    public void toBinary(DataOutputStream writer) throws IOException{
        writer.writeByte(tag);
        writer.writeShort(bytes.length);
        writer.write(bytes);
    }    
}

⌨️ 快捷键说明

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