List<Constant> constants = new ArrayList<>(); byte[] bytecode = ... // reads the class byte code int constantPoolCount = getConstantPoolCount(bytecode); int offset = getConstantPoolStartOffset(bytecode); for(int i = 1; i < constantPoolCount; i++){ int tag = bytecode[offset]; offset++; if(tag == LONG_CONSTANT_TAG) { byte[] highBytes = Arrays.copyOfRange(bytecode, offset, offset+4); offset += 4; byte[] lowBytes = Arrays.copyOfRange(bytecode, offset, offset+4); offset += 4; ConstantLong c = new ConstantLong(highBytes, lowBytes); constants.add(c); // because we are at CONSTANT LONG, the entry at n+1 is not used constants.add(null); i++; } else if(tag == DOUBLE_CONSTANT_TAG) { ... // performs the same, like LONG_CONSTANT_TAG } // read more entries without skip indexes. }
buf = String.valueOf(((ConstantLong) c).getBytes()); break; case Constants.CONSTANT_Float:
buf = String.valueOf(((ConstantLong) c).getBytes()); break; case Constants.CONSTANT_Float:
return new ConstantFloat(dataInput); case Const.CONSTANT_Long: return new ConstantLong(dataInput); case Const.CONSTANT_Double: return new ConstantDouble(dataInput);
buf = String.valueOf(((ConstantLong) c).getBytes()); break; case Constants.CONSTANT_Float:
return new ConstantFloat(file); case Constants.CONSTANT_Long: return new ConstantLong(file); case Constants.CONSTANT_Double: return new ConstantDouble(file);
ConstantLong j = (ConstantLong) cpool.getConstant(getIndex(), Constants.CONSTANT_Long); return Long.toString(j.getBytes()); case PRIMITIVE_DOUBLE: ConstantDouble d = (ConstantDouble) cpool.getConstant(getIndex(),
return new ConstantFloat(file); case Constants.CONSTANT_Long: return new ConstantLong(file); case Constants.CONSTANT_Double: return new ConstantDouble(file);
ConstantLong j = (ConstantLong) cpool.getConstant(getIndex(), Constants.CONSTANT_Long); return Long.toString(j.getBytes()); case PRIMITIVE_DOUBLE: ConstantDouble d = (ConstantDouble) cpool.getConstant(getIndex(),
return new ConstantFloat(file); case Constants.CONSTANT_Long: return new ConstantLong(file); case Constants.CONSTANT_Double: return new ConstantDouble(file);
ConstantLong j = (ConstantLong) cpool.getConstant(getIndex(), Constants.CONSTANT_Long); return Long.toString(j.getBytes()); case PRIMITIVE_DOUBLE: ConstantDouble d = (ConstantDouble) cpool.getConstant(getIndex(),
return new ConstantFloat(file); case Constants.CONSTANT_Long: return new ConstantLong(file); case Constants.CONSTANT_Double: return new ConstantDouble(file);
ConstantLong j = (ConstantLong) cpool.getConstant(getIndex(), Constants.CONSTANT_Long); return Long.toString(j.getBytes()); case PRIMITIVE_DOUBLE: ConstantDouble d = (ConstantDouble) cpool.getConstant(getIndex(),
final ConstantLong j = (ConstantLong) cpool.getConstant(getIndex(), Const.CONSTANT_Long); return Long.toString(j.getBytes()); case PRIMITIVE_DOUBLE: final ConstantDouble d = (ConstantDouble) cpool.getConstant(getIndex(),
break; case Constants.CONSTANT_Long: str = String.valueOf(((ConstantLong) c).getBytes()); break; case Constants.CONSTANT_Integer:
break; case Constants.CONSTANT_Long: str = String.valueOf(((ConstantLong) c).getBytes()); break; case Constants.CONSTANT_Integer:
break; case Constants.CONSTANT_Long: str = String.valueOf(((ConstantLong) c).getBytes()); break; case Constants.CONSTANT_Integer:
break; case Constants.CONSTANT_Long: str = String.valueOf(((ConstantLong) c).getBytes()); break; case Constants.CONSTANT_Integer: