LibJClass Reference Manual |
---|
Jar files — Operations on jar files.
#include <jclass/jar.h> JarFile* jclass_jar_open (const char *filename); void jclass_jar_close (JarFile *jar); void jclass_jar_rewind (JarFile *jar); const JarEntry* jclass_jar_get_next_entry (JarFile *jar); const JarEntry* jclass_jar_get_entry (JarFile *jar, const char *name); char* jclass_jar_entry_read (JarFile *jar, const JarEntry *entry); const char* jclass_jar_entry_get_name (const JarEntry *entry); uint32_t jclass_jar_entry_get_size (const JarEntry *entry); Manifest* jclass_jar_get_manifest (JarFile *jar);
A jar file is an archive in zip format containing classes and resources for java applications and libraries.
JarFile* jclass_jar_open (const char *filename);
Opens a jar stream for reading.
filename : | The filename for the jar file. |
Returns : | A newly allocated jar stream on success, or NULL if any error occured. |
void jclass_jar_close (JarFile *jar);
Closes a jar stream and frees the memory allocated for it.
jar : | The jar stream to close. |
void jclass_jar_rewind (JarFile *jar);
Rewinds a jar file (i.e. goes to the first file).
jar : | The jar file to rewind. |
const JarEntry* jclass_jar_get_next_entry (JarFile *jar);
Reads the current entry from a jar stream and advances the current entry "pointer".
jar : | opened jar. |
Returns : | A pointer to the entry on success, or NULL if any errors occured while reading the entry. |
const JarEntry* jclass_jar_get_entry (JarFile *jar, const char *name);
Gives the JarEntry with the given name.
jar : | The jar file to get the entry from. |
name : | The name of the entry. Path seperator is always '/'. |
Returns : | A JarEntry you should not modify. |
char* jclass_jar_entry_read (JarFile *jar, const JarEntry *entry);
Loads the contents of a zip entry into a char buffer.
jar : | The jar file containing the entry. |
entry : | The entry to read data from. |
Returns : | A char buffer alloced with malloc on success, NULL otherwise. |
const char* jclass_jar_entry_get_name (const JarEntry *entry);
Gives the name of the given JarEntry.
entry : | The entry to get its name. |
Returns : | A string you should not modify. |
uint32_t jclass_jar_entry_get_size (const JarEntry *entry);
Gives the size of the given JarEntry.
entry : | The entry to get its size. |
Returns : | The size of the entry as an unsigned 32-bit integer. |
Manifest* jclass_jar_get_manifest (JarFile *jar);
Gets the manifest for the given jar.
jar : | The jar file to get its manifest. |
Returns : | A Manifest struct or NULL if something went wrong. |
<< Class Loader | manifest >> |