public class ClassFileReader extends Object
Constructor and Description |
---|
ClassFileReader() |
Modifier and Type | Method and Description |
---|---|
(package private) static RVMMethod |
getClassInitializerMethod(RVMMethod[] declaredMethods)
Returns the class initializer method among the declared methods of the class
|
(package private) static FieldReference |
getFieldRef(int[] constantPool,
int constantPoolIndex) |
(package private) static byte |
getLiteralDescription(int[] constantPool,
int constantPoolIndex) |
(package private) static Offset |
getLiteralOffset(int[] constantPool,
int constantPoolIndex)
Get offset of a literal constant, in bytes.
|
(package private) static int |
getLiteralSize(int[] constantPool,
int constantPoolIndex) |
(package private) static MethodReference |
getMethodRef(int[] constantPool,
int constantPoolIndex) |
(package private) static TypeReference |
getTypeRef(int[] constantPool,
int constantPoolIndex) |
(package private) static Atom |
getUtf(int[] constantPool,
int constantPoolIndex) |
(package private) static int |
packCPEntry(byte type,
int value) |
(package private) static boolean |
packedCPTypeIsClassType(int cpValue) |
(package private) static int |
packTempCPEntry(int index1,
int index2) |
(package private) static RVMClass |
readClass(TypeReference typeRef,
DataInputStream input)
Creates an instance of a RVMClass.
|
(package private) static int[] |
readConstantPool(TypeReference typeRef,
DataInputStream input)
Parse and return the constant pool in a class file
|
(package private) static RVMField[] |
readDeclaredFields(TypeReference typeRef,
DataInputStream input,
int[] constantPool) |
(package private) static RVMClass[] |
readDeclaredInterfaces(DataInputStream input,
int[] constantPool) |
(package private) static RVMMethod[] |
readDeclaredMethods(TypeReference typeRef,
DataInputStream input,
int[] constantPool) |
(package private) static RVMClass |
readSuperClass(DataInputStream input,
int[] constantPool,
short modifiers) |
(package private) static int |
readTypeRef(TypeReference typeRef,
DataInputStream input,
int[] constantPool)
Read the class' TypeReference
|
(package private) static byte |
unpackCPType(int cpValue) |
(package private) static int |
unpackSignedCPValue(int cpValue) |
(package private) static int |
unpackTempCPIndex1(int cpValue) |
(package private) static int |
unpackTempCPIndex2(int cpValue) |
(package private) static int |
unpackUnsignedCPValue(int cpValue) |
public ClassFileReader()
static int[] readConstantPool(TypeReference typeRef, DataInputStream input) throws ClassFormatError, IOException
typeRef
- the canonical type reference for this type.input
- the data stream from which to read the class's description.IOException
- if it occurs during reading of the input streamClassFormatError
static int readTypeRef(TypeReference typeRef, DataInputStream input, int[] constantPool) throws IOException, ClassFormatError
typeRef
- the type reference that we're expecting to readinput
- input streamconstantPool
- constant poolIOException
- when a problems occurs while reading the input streamClassFormatError
- when the read type ref does not match up with the expected type refstatic RVMClass readSuperClass(DataInputStream input, int[] constantPool, short modifiers) throws IOException, NoClassDefFoundError
IOException
NoClassDefFoundError
static RVMClass[] readDeclaredInterfaces(DataInputStream input, int[] constantPool) throws IOException, NoClassDefFoundError
IOException
NoClassDefFoundError
static RVMField[] readDeclaredFields(TypeReference typeRef, DataInputStream input, int[] constantPool) throws IOException
IOException
static RVMMethod[] readDeclaredMethods(TypeReference typeRef, DataInputStream input, int[] constantPool) throws IOException
IOException
static RVMMethod getClassInitializerMethod(RVMMethod[] declaredMethods)
declaredMethods
- the methods declared by the class<clinit>
of the class or null
if none was foundstatic RVMClass readClass(TypeReference typeRef, DataInputStream input) throws ClassFormatError, IOException
typeRef
- the canonical type reference for this type.input
- the data stream from which to read the class's description.IOException
- when data cannot be read from the input stream or
skipping during class construction reads less data than expectedClassFormatError
- when the class data is corruptstatic int packCPEntry(byte type, int value)
static byte unpackCPType(int cpValue)
static int unpackSignedCPValue(int cpValue)
static int unpackUnsignedCPValue(int cpValue)
static boolean packedCPTypeIsClassType(int cpValue)
static int packTempCPEntry(int index1, int index2)
static int unpackTempCPIndex1(int cpValue)
static int unpackTempCPIndex2(int cpValue)
static int getLiteralSize(int[] constantPool, int constantPoolIndex)
static Offset getLiteralOffset(int[] constantPool, int constantPoolIndex)
constantPool
- the constant poolconstantPoolIndex
- the index into the constant poolstatic byte getLiteralDescription(int[] constantPool, int constantPoolIndex)
static TypeReference getTypeRef(int[] constantPool, int constantPoolIndex)
static MethodReference getMethodRef(int[] constantPool, int constantPoolIndex)
static FieldReference getFieldRef(int[] constantPool, int constantPoolIndex)