CBMC
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | List of all members
jar_filet Class Referencefinal

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.
 
  jar_filet (const void *data, size_t size)
  Open a JAR file of size size loaded in memory at address data.
 
 
 
 
 
 
std::optional< std::string >  get_entry (const std::string &filename)
  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)
 
std::vector< std::string >  filenames () const
  Get list of filenames in the archive.
 

Private Member Functions

  Loads the fileindex (m_name_to_index) with a map of loaded files to indices.
 

Private Attributes

 
std::unordered_map< std::string, size_tm_name_to_index
  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]

jar_filet::jar_filet ( const voiddata,
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.

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::jar_filet ( const jar_filet &  )
delete

◆  jar_filet() [4/4]

jar_filet::jar_filet ( jar_filet &&  other )

Definition at line 44 of file jar_file.cpp.

◆  ~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]

jar_filet & jar_filet::operator= ( const jar_filet &  )
delete

◆  operator=() [2/2]

jar_filet & jar_filet::operator= ( jar_filet &&  other )

Definition at line 50 of file jar_file.cpp.

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

mz_zip_archivet jar_filet::m_zip_archive
private

Definition at line 58 of file jar_file.h.


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

AltStyle によって変換されたページ (->オリジナル) /