{"id":13344103,"url":"https://github.com/buggysofts-com/AndroidZip","last_synced_at":"2025-03-12T06:31:13.876Z","repository":{"id":58094247,"uuid":"529958685","full_name":"buggysofts-com/AndroidZip","owner":"buggysofts-com","description":"A convenient zip explorer library for Android that uses DocumentFile (instead of File object) as its source.","archived":false,"fork":false,"pushed_at":"2022-10-16T10:13:57.000Z","size":122,"stargazers_count":8,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-24T16:50:47.628Z","etag":null,"topics":["android","documentfile","scoped-storage","zip"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/buggysofts-com.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-28T19:25:03.000Z","updated_at":"2024-03-12T09:09:19.000Z","dependencies_parsed_at":"2023-01-20T03:47:52.716Z","dependency_job_id":null,"html_url":"https://github.com/buggysofts-com/AndroidZip","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buggysofts-com%2FAndroidZip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buggysofts-com%2FAndroidZip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buggysofts-com%2FAndroidZip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buggysofts-com%2FAndroidZip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/buggysofts-com","download_url":"https://codeload.github.com/buggysofts-com/AndroidZip/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243171636,"owners_count":20247878,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","documentfile","scoped-storage","zip"],"created_at":"2024-07-29T19:32:27.541Z","updated_at":"2025-03-12T06:31:13.310Z","avatar_url":"https://github.com/buggysofts-com.png","language":"Java","readme":"# AndroidZip [![](https://jitpack.io/v/buggysofts-com/AndroidZip.svg)](https://jitpack.io/#buggysofts-com/AndroidZip)\nA zip explorer library for android that uses \u003cb\u003eDocumentFile\u003c/b\u003e object as its source. It uses my **StreamZip** library as its base. Its functionalities are similar to the standard java **ZipFile** class.\n\n\u003cbr /\u003e\n\n## Import\nAdd JitPack repository to your project level build.gradle file\n```\n...\n\nallprojects {\n    repositories {\n        ...\n        maven { url 'https://jitpack.io' }\n    }\n}\n```\nOr, in newer android projects, if you need to add the repository in settings.gradle file...\n```\n...\n\ndependencyResolutionManagement {\n    ...\n    repositories {\n        ...\n        maven { url 'https://jitpack.io' }\n    }\n}\n```\nFinally, add these two dependencies to your app/module level build.gradle file\n```\n...\n\ndependencies {\n    ...\n    implementation 'com.github.buggysofts-com:StreamZip:v1.0.6'\n    implementation 'com.github.buggysofts-com:AndroidZip:v1.0.6'\n}\n```\nAnd you are done importing the library.\n\n\u003cbr /\u003e\n\n## Sample codes\n\nTo create an instance  do something like...\n\n```\nAndroidZip zip = null;\ntry {\n    zip = new AndroidZip(MainActivity.this, documentFile);\n} catch (Exception e) {\n    e.printStackTrace();\n} finally {\n    if(zip != null){\n        List\u003cZipEntry\u003e entries = zip.entries();\n        for (int i = 0; i \u003c entries.size(); i++) {\n            // do something\n        }\n    }\n}\n```\n\n\u003cbr /\u003e\n\nThen you can use different methods that are similar to the standard java ZipFile class. For example here are the\npublicly available methods.\n\n- ```getEntry(String name)``` Returns the entry mapped with the specified name, or null if there is no entry mapped with that name.\n- ```entries()``` Returns all the available entries as a list of \u003cb\u003eZipEntry\u003c/b\u003e.\n- ```getInputStream(...)``` Opens(and returns) a bounded input stream currently positioning at the start of the requested entry's data block.\n- ```size()``` Returns the total number of available entries.\n- ```getComment()``` Returns the principal comment of the zip file.\n- ```close()``` Closes the zip file, and any subsequent call to \u003cb\u003egetInputStream(...)\u003c/b\u003e will throw an exception. However, other methods of the class that are saved in memory will still be available after call to \u003cb\u003eclose()\u003c/b\u003e.\n\n**Please Note**\n\n- The **ZipEntry** we mentioned above is a part of this library and has similar methods as the standard **ZipEntry**\n  class\n  in java jdk.\n- If you do not have a **ZipEntry** instance, and only have the name of the entry, you can use the minimal\n  constructor (\n  i.e.  ```ZipEntry(String name)```) to obtain an input stream. Of course, you would get an exception if the entry does\n  not\n  exist.\n\n\u003cbr /\u003e\n\n### Performance\n\nThe performance is similar to the Standard **ZipFile** class. Before this, the only way to read a zip file in this kind\nof situation was to use the **ZipInputStream** class which basically reads every byte in its way to get to the next\nentry. That is, to list, or to get data of all the entries of a zip file, it is equivalent of reading the whole file.\nImagine you have to read some metadata within some big zip files, may be 100 zip files, think how much time it would\ntake!\nOf course, you can use some caching technique, which I was doing for a long time, in fact there is still a library in\nthe git repo, which does exactly that. But in any way, that is not enough, it takes a lot of memory, and the performance\nis limited to many constraints.\n\n\u003cbr /\u003e\n\nPlease share \u0026 rate the library if you find it useful.\n\n### Happy coding!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuggysofts-com%2FAndroidZip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbuggysofts-com%2FAndroidZip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuggysofts-com%2FAndroidZip/lists"}