LibJClass Reference Manual |
---|
Class Loader — Class loading features.
#include <jclass/class_loader.h> typedef ClassFile; typedef ClassLoader; ClassLoader* jclass_classloader_get_current (void); ClassLoader* jclass_classloader_get_default (void); void jclass_classloader_set (ClassLoader *classloader); char* jclass_classloader_get_class_filename (const char *class_name, const ClassPath *classpath); ClassFile* jclass_classloader_get_class_file (const char *class_name, const ClassPath *classpath); ClassPath* jclass_classloader_get_classpath (const char *classpath_string, const char *bootclasspath_string); void jclass_classloader_classpath_free (ClassPath *path); #define foreach_in_classpath (node, path)
libjclass can retrieve classes directly from .class files or from jar archives attempting to imitate the behaviour of the Sun Java VM. As of version 0.3 it is possible to override the default classloader.
typedef struct { FILE* file_ptr; char* data; } ClassFile;
A structure represending a loaded (but not yet parsed) class file.
typedef struct { /* A pointer to the function that returns the filename a class is in */ char* (*get_class_filename) (const char*, const ClassPath*); /* A pointer to the function that returns a ClassFile struct for the given class */ ClassFile* (*get_class_file) (const char*, const ClassPath*); ClassPath* (*get_classpath) (const char*, const char*); } ClassLoader;
A structure represending a class loader.
ClassLoader* jclass_classloader_get_current (void);
Gives the current class loader.
Since: 0.3
Returns : | A pointer to the current class loader. |
ClassLoader* jclass_classloader_get_default (void);
Gives the default class loader.
Since: 0.3
Returns : | A pointer to the default classloader. |
void jclass_classloader_set (ClassLoader *classloader);
Overrides the classloader for the library. If NULL is passed then the default classloader will be used.
Since: 0.3
classloader : | The new classloader or NULL to revert to the default. |
char* jclass_classloader_get_class_filename (const char *class_name, const ClassPath *classpath);
Finds the URL that contains the class with the given name.
Since: 0.3
class_name : | The fully qualified name of the class. |
classpath : | The classpath to use. |
Returns : | A string allocated with malloc. |
ClassFile* jclass_classloader_get_class_file (const char *class_name, const ClassPath *classpath);
Gives the given class in a file or a memory buffer.
Since: 0.3
class_name : | The fully qualified name of the class. |
classpath : | The classpath to use. |
Returns : | A ClassFile struct allocated with malloc. |
ClassPath* jclass_classloader_get_classpath (const char *classpath_string, const char *bootclasspath_string);
Gives the classpath for the given classpath and bootstrap claspath strings.
Since: 0.4
classpath_string : | The classpathe. |
bootclasspath_string : | The classpath for bootstrap classes. |
Returns : | A ClassPath struct. |
void jclass_classloader_classpath_free (ClassPath *path);
Frees the given classpath struct.
path : | The classpath to free. |
<< Code Disassembly | Jar files >> |