cprover
Loading...
Searching...
No Matches
jar_file.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: Jar file reader
4
5Author: Diffblue Ltd
6
7\*******************************************************************/
8
9#ifndef CPROVER_JAVA_BYTECODE_JAR_FILE_H
10#define CPROVER_JAVA_BYTECODE_JAR_FILE_H
11
12#include <unordered_map>
13#include <string>
14#include <vector>
15
16#include <util/optional.h>
17
18#include "mz_zip_archive.h"
19
22class jar_filet final
23{
24public:
28 explicit jar_filet(const std::string &filename);
29
34 jar_filet(const void *data, size_t size);
35
36 jar_filet(const jar_filet &)=delete;
37 jar_filet &operator=(const jar_filet &)=delete;
40 ~jar_filet()=default;
41
45 optionalt<std::string> get_entry(const std::string &filename);
46
49 std::unordered_map<std::string, std::string> get_manifest();
50
52 std::vector<std::string> filenames() const;
53
54private:
58
60
62 std::unordered_map<std::string, size_t> m_name_to_index;
63};
64
65#endif // CPROVER_JAVA_BYTECODE_JAR_FILE_H
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:564
Class representing a .jar archive.
Definition jar_file.h:23
mz_zip_archivet m_zip_archive
Definition jar_file.h:59
jar_filet(const jar_filet &)=delete
std::unordered_map< std::string, size_t > m_name_to_index
Map of filename to the file index in the zip archive.
Definition jar_file.h:62
~jar_filet()=default
std::vector< std::string > filenames() const
Get list of filenames in the archive.
Definition jar_file.cpp:123
optionalt< std::string > get_entry(const std::string &filename)
Get contents of a file in the jar archive.
Definition jar_file.cpp:57
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)
Definition jar_file.cpp:99
void initialize_file_index()
Loads the fileindex (m_name_to_index) with a map of loaded files to indices.
Definition jar_file.cpp:15
jar_filet & operator=(const jar_filet &)=delete
Thin object-oriented wrapper around the MZ Zip library Zip file reader and extractor.
Definition kdev_t.h:24