Loading...
Searching...
No Matches
jar_filet Class Referencefinal
Class representing a .jar archive.
More...
#include <jar_file.h>
+ Collaboration diagram for jar_filet:
Open java file for reading.
Open a JAR file of size size loaded in memory at address data.
Get contents of a file in the jar archive.
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)
Get list of filenames in the archive.
Loads the fileindex (m_name_to_index) with a map of loaded files to indices.
Map of filename to the file index in the zip archive.
Detailed Description
Class representing a .jar archive.
Uses miniz to decompress and index archive.
Definition at line 21 of file jar_file.h.
Constructor & Destructor Documentation
◆ jar_filet() [1/4]
jar_filet::jar_filet
(
const std::string &
filename )
explicit
Open java file for reading.
This constructor creates a jar_file object whose contents are extracted from a file with given name.
- Parameters
-
filename Name of the file
- Exceptions
-
Throws std::runtime_error if file cannot be opened
Definition at line 24 of file jar_file.cpp.
◆ jar_filet() [2/4]
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.
- Parameters
-
data memory buffer with the contents of the jar file
size size of the memory buffer
- Exceptions
-
Throws std::runtime_error if data is not in correct format
Definition at line 34 of file jar_file.cpp.
◆ jar_filet() [3/4]
◆ jar_filet() [4/4]
◆ ~jar_filet()
jar_filet::~jar_filet
(
)
default
Member Function Documentation
◆ filenames()
std::vector< std::string > jar_filet::filenames
(
)
const
Get list of filenames in the archive.
Definition at line 123 of file jar_file.cpp.
◆ get_entry()
std::optional< 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.
- Parameters
-
filename Name of the file in the archive
Definition at line 57 of file jar_file.cpp.
◆ get_manifest()
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.
◆ initialize_file_index()
void jar_filet::initialize_file_index
(
)
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.
◆ operator=() [1/2]
◆ operator=() [2/2]
Member Data Documentation
◆ m_name_to_index
std::unordered_map<std::string,
size_t> jar_filet::m_name_to_index
private
Map of filename to the file index in the zip archive.
Definition at line 61 of file jar_file.h.
◆ m_zip_archive
The documentation for this class was generated from the following files:
- /home/runner/work/cbmc/cbmc/jbmc/src/java_bytecode/jar_file.h
- /home/runner/work/cbmc/cbmc/jbmc/src/java_bytecode/jar_file.cpp