cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
jar_file.h
Go to the documentation of this file.
1
/*******************************************************************\
2
3
Module: Jar file reader
4
5
Author: Diffblue Ltd
6
7
\*******************************************************************/
8
9
#ifndef CPROVER_JAVA_BYTECODE_JAR_FILE_H
10
#define CPROVER_JAVA_BYTECODE_JAR_FILE_H
11
12
#include "
mz_zip_archive.h
"
13
14
#include <optional>
15
#include <string>
16
#include <unordered_map>
17
#include <vector>
18
21
class
jar_filet
final
22
{
23
public
:
27
explicit
jar_filet
(
const
std::string &filename);
28
33
jar_filet
(
const
void
*
data
,
size_t
size);
34
35
jar_filet
(
const
jar_filet
&)=
delete
;
36
jar_filet
&
operator=
(
const
jar_filet
&)=
delete
;
37
jar_filet
(
jar_filet
&&);
38
jar_filet
&
operator=
(
jar_filet
&&);
39
~jar_filet
()=
default
;
40
44
std::optional<std::string>
get_entry
(
const
std::string &filename);
45
48
std::unordered_map<std::string, std::string>
get_manifest
();
49
51
std::vector<std::string>
filenames
()
const
;
52
53
private
:
56
void
initialize_file_index
();
57
58
mz_zip_archivet
m_zip_archive
;
59
61
std::unordered_map<std::string, size_t>
m_name_to_index
;
62
};
63
64
#endif
// CPROVER_JAVA_BYTECODE_JAR_FILE_H
jar_filet::m_zip_archive
mz_zip_archivet m_zip_archive
Definition
jar_file.h:58
jar_filet::jar_filet
jar_filet(const jar_filet &)=delete
jar_filet::m_name_to_index
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:61
jar_filet::~jar_filet
~jar_filet()=default
jar_filet::get_entry
std::optional< std::string > get_entry(const std::string &filename)
Get contents of a file in the jar archive.
Definition
jar_file.cpp:57
jar_filet::filenames
std::vector< std::string > filenames() const
Get list of filenames in the archive.
Definition
jar_file.cpp:123
jar_filet::jar_filet
jar_filet(const std::string &filename)
Open java file for reading.
Definition
jar_file.cpp:24
jar_filet::get_manifest
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
jar_filet::initialize_file_index
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=
jar_filet & operator=(const jar_filet &)=delete
mz_zip_archivet
Thin object-oriented wrapper around the MZ Zip library Zip file reader and extractor.
Definition
mz_zip_archive.h:21
mz_zip_archive.h
data
Definition
kdev_t.h:24
jbmc
src
java_bytecode
jar_file.h
Generated by
1.17.0