Package classycle.classfile
Class Constant
java.lang.Object
classycle.classfile.Constant
- Direct Known Subclasses:
ClassConstant,DoubleConstant,FloatConstant,IntConstant,InvokeDynamicConstant,LongConstant,MethodHandleConstant,MethodTypeConstant,NameAndTypeConstant,RefConstant,StringConstant,UTF8Constant
Abstract super class of all type of constants in the constant pool of
a class file.
- Author:
- Franz-Josef Elmer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Constant[]extractConstantPool(DataInputStream stream) Extracts the constant pool from the specified data stream of a class file.getConstant(int index) Returns the specified constant from the pool.
-
Constructor Details
-
Constant
Creates an instance.- Parameters:
pool- The poole which will be needed to resolve references.
-
-
Method Details
-
extractConstantPool
Extracts the constant pool from the specified data stream of a class file.- Parameters:
stream- Input stream of a class file starting at the first byte.- Returns:
- extracted array of constants.
- Throws:
IOException- in case of reading errors or invalid class file.
-
getConstant
Returns the specified constant from the pool.- Parameters:
index- Index of requested constant.
-