constantpool.java

来自「JASML is a java byte code compiler, prov」· Java 代码 · 共 39 行

JAVA
39
字号
/*
 * Author jyang Created on 2006-4-3 14:35:41
 */
package com.jasml.classes;

public class ConstantPool {
    ConstantPoolItem[] poolItems;

    public ConstantPool(ConstantPoolItem[] items) {
        poolItems = items;
    }

    public ConstantPoolItem getConstant(int index) {
        return poolItems[index];
    }

    public int getConstantPoolCount() {
        return poolItems.length;
    }

    public String toString() {
        StringBuffer buf = new StringBuffer();
        ConstantPoolItem item;
        for (int i = 0; i < poolItems.length; i++) {
            item = poolItems[i];
            if (item != null) {
                buf.append(i + " : " + item.toString() + "\r\n");
                if (item instanceof Constant_Double || item instanceof Constant_Long) {
                    i++;
                }
            } else {
                buf.append(i + " : N/A\r\n");
            }
        }
        return buf.toString();
    }
    

}

⌨️ 快捷键说明

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