@@ -21,16 +21,25 @@ class java_class_loader_limitt;
2121class jar_filet final
2222{
2323public:
24- // / Open java file for reading
24+ // / Open java file for reading.
2525 // / \param limit Object limiting number of loaded .class files
2626 // / \param filename Name of the file
2727 // / \throw Throws std::runtime_error if file cannot be opened
2828 jar_filet (java_class_loader_limitt &limit, const std::string &filename);
29+
30+ // / Open a JAR file of size \p size loaded in memory at address \p data.
31+ // / \param limit Object limiting number of loaded .class files
32+ // / \param data memory buffer with the contents of the jar file
33+ // / \param size size of the memory buffer
34+ // / \throw Throws std::runtime_error if file cannot be opened
35+ jar_filet (java_class_loader_limitt &limit, const void *data, size_t size);
36+
2937 jar_filet (const jar_filet &)=delete ;
3038 jar_filet &operator =(const jar_filet &)=delete ;
3139 jar_filet (jar_filet &&);
3240 jar_filet &operator =(jar_filet &&);
3341 ~jar_filet ()=default ;
42+
3443 // / Get contents of a file in the jar archive.
3544 // / Terminates the program if file doesn't exist
3645 // / \param filename Name of the file in the archive
@@ -40,8 +49,12 @@ class jar_filet final
4049 // / Get list of filenames in the archive
4150 std::vector<std::string> filenames () const ;
4251private:
52+ // / Loads the fileindex (m_name_to_index) with a map of loaded files to
53+ // / indices.
54+ void initialize_file_index (java_class_loader_limitt &limit);
55+
4356 mz_zip_archivet m_zip_archive;
44- // / Map of filename to the file index in the zip archive
57+ // / Map of filename to the file index in the zip archive.
4558 std::unordered_map<std::string, size_t > m_name_to_index;
4659};
4760
0 commit comments