JVM
javaclass.c File Reference
#include "readfunctions.h"
#include "javaclass.h"
#include "constantpool.h"
#include "utf8.h"
#include "validity.h"
#include "debugging.h"
Include dependency graph for javaclass.c:

Functions

void openClassFile (JavaClass *jc, const char *path)
 Opens a class file and parse it, storing the class information in the JavaClass structure. More...
 
void closeClassFile (JavaClass *jc)
 Closes the .class file and releases resources used by the JavaClass struct. More...
 
const char * decodeJavaClassStatus (enum JavaClassStatus status)
 Decodes JavaClassStatus enumeration elements. More...
 
void decodeAccessFlags (uint16_t flags, char *buffer, int32_t buffer_len, enum AccessFlagsType acctype)
 Given flags of a certain method/field/class, this class will convert the bits to a string telling which flags are set to 1, writing the result in the output buffer. More...
 

Function Documentation

§ closeClassFile()

void closeClassFile ( JavaClass jc)

Closes the .class file and releases resources used by the JavaClass struct.

Parameters
JavaClass*jc - pointer to the class to be closed.
Note
This function does not free the *jc pointer.
See also
openClassFile()
Here is the call graph for this function:
Here is the caller graph for this function:

§ decodeAccessFlags()

void decodeAccessFlags ( uint16_t  flags,
char *  buffer,
int32_t  buffer_len,
enum AccessFlagsType  acctype 
)

Given flags of a certain method/field/class, this class will convert the bits to a string telling which flags are set to 1, writing the result in the output buffer.

Parameters
uint16_tflags - the flags of the method/field/class
[out]char*buffer - pointer to where the string will be stored
int32_tbuffer_len - length of the buffer
enumAccessFlagsType acctype - type of access flags, telling if it is a class, a method or a field.

This method will write at most buffer_len characters to the output buffer. Depending on parameter acctype, meaning for some bits might change.

Here is the call graph for this function:
Here is the caller graph for this function:

§ decodeJavaClassStatus()

const char* decodeJavaClassStatus ( enum JavaClassStatus  status)

Decodes JavaClassStatus enumeration elements.

Parameters
enumJavaClassStatus status - identifier of the enumeration to be translated.
Returns
const char* - pointer to char containing the decoded status
Here is the caller graph for this function:

§ openClassFile()

void openClassFile ( JavaClass jc,
const char *  path 
)

Opens a class file and parse it, storing the class information in the JavaClass structure.

Parameters
JavaClass*jc - pointer to the structure that will hold the class data
constchar* path - string containing the path to the class file to be read

This function opens the .class file and reads its content from the file by filling in the fields of the JavaClass struct. A bunch of other functions from different modules are called to read some pieces of the class file. Various checks are made during the parsing of the read data.

See also
closeClassFile, printClassFileInfo(), printClassFileDebugInfo()
Here is the call graph for this function:
Here is the caller graph for this function: