|
CBMC
|
Class representing a .jar archive. More...
#include <jar_file.h>
Collaboration diagram for jar_filet:Public Member Functions | |
| jar_filet (const std::string &filename) | |
| Open java file for reading. More... | |
| jar_filet (const void *data, size_t size) | |
Open a JAR file of size size loaded in memory at address data. More... | |
| jar_filet (const jar_filet &)=delete | |
| jar_filet & | operator= (const jar_filet &)=delete |
| jar_filet (jar_filet &&) | |
| jar_filet & | operator= (jar_filet &&) |
| ~jar_filet ()=default | |
| optionalt< std::string > | get_entry (const std::string &filename) |
| Get contents of a file in the jar archive. More... | |
| std::unordered_map< std::string, std::string > | get_manifest () |
| Get contents of the Manifest file in the jar archive as a key-value map (both as strings) More... | |
| std::vector< std::string > | filenames () const |
| Get list of filenames in the archive. More... | |
Private Member Functions | |
| void | initialize_file_index () |
| Loads the fileindex (m_name_to_index) with a map of loaded files to indices. More... | |
Private Attributes | |
| mz_zip_archivet | m_zip_archive |
| std::unordered_map< std::string, size_t > | m_name_to_index |
| Map of filename to the file index in the zip archive. More... | |
Class representing a .jar archive.
Uses miniz to decompress and index archive.
Definition at line 22 of file jar_file.h.
|
explicit |
Open java file for reading.
This constructor creates a jar_file object whose contents are extracted from a file with given name.
| filename | Name of the file |
| Throws | std::runtime_error if file cannot be opened |
Definition at line 24 of file jar_file.cpp.
| jar_filet::jar_filet | ( | const void * | data, |
| size_t | size | ||
| ) |
Open a JAR file of size size loaded in memory at address data.
This constructor creates a jar_file object whose contents are extracted from a memory buffer (byte array) as opposed to a jar file.
| data | memory buffer with the contents of the jar file |
| size | size of the memory buffer |
| Throws | std::runtime_error if data is not in correct format |
Definition at line 34 of file jar_file.cpp.
|
delete |
| jar_filet::jar_filet | ( | jar_filet && | other | ) |
Definition at line 44 of file jar_file.cpp.
|
default |
| std::vector< std::string > jar_filet::filenames | ( | ) | const |
Get list of filenames in the archive.
Definition at line 123 of file jar_file.cpp.
| optionalt< std::string > jar_filet::get_entry | ( | const std::string & | filename | ) |
Get contents of a file in the jar archive.
Returns nullopt if file doesn't exist.
| filename | Name of the file in the archive |
Definition at line 57 of file jar_file.cpp.
| std::unordered_map< std::string, std::string > jar_filet::get_manifest | ( | ) |
Get contents of the Manifest file in the jar archive as a key-value map (both as strings)
Definition at line 99 of file jar_file.cpp.
|
private |
Loads the fileindex (m_name_to_index) with a map of loaded files to indices.
Definition at line 15 of file jar_file.cpp.
Definition at line 50 of file jar_file.cpp.
|
private |
Map of filename to the file index in the zip archive.
Definition at line 62 of file jar_file.h.
|
private |
Definition at line 59 of file jar_file.h.