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

📄 exceptionsattr.java

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

import gen.constvalue.AttrInfoTag;
import java.io.DataOutputStream;
import java.io.IOException;

/**
 *  Exceptions_attribute {
 *      u2 attribute_name_index;
 *      u4 attribute_length;
 *      u2 number_of_exceptions;
 *      u2 exception_index_table[number_of_exceptions];
 *  }
 *
 * @author liuyi
 *
 */
public class ExceptionsAttr extends AttributeInfo implements AttrInfoTag {
    
    private final short number_of_exceptions = 1;
    
    //special here
    private short exceptionIndex; 
    
    /**
     * @param tag
     */
    public ExceptionsAttr() {
        super(ATTR_Exceptions);
        length = 4;
    }
    
    public short getExceptionNumber(){
        return number_of_exceptions;
    }
    
    public void setExceptionIndex(int exceptionIndex){
        this.exceptionIndex = (short)exceptionIndex;
    }
    
    public int getExceptionIndex(){
        return exceptionIndex;
    }

    public void toBinary(DataOutputStream writer) throws IOException {
        writer.writeShort(nameIndex);
        writer.writeInt(length);
        writer.writeShort(number_of_exceptions);
        writer.writeShort(exceptionIndex);
    }
    
}

⌨️ 快捷键说明

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