{"id":20924670,"url":"https://github.com/kiwix/java-libkiwix","last_synced_at":"2025-05-13T16:31:26.716Z","repository":{"id":37791802,"uuid":"366984604","full_name":"kiwix/java-libkiwix","owner":"kiwix","description":"Libkiwix binding for Java \u0026 Kotlin","archived":false,"fork":false,"pushed_at":"2024-04-22T17:33:31.000Z","size":1539,"stargazers_count":2,"open_issues_count":7,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-05-01T11:34:27.589Z","etag":null,"topics":["java","kiwix","kotlin","libkiwix","zim"],"latest_commit_sha":null,"homepage":"https://central.sonatype.com/artifact/org.kiwix/libkiwix","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kiwix.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-13T08:31:07.000Z","updated_at":"2024-05-02T12:42:51.151Z","dependencies_parsed_at":"2023-02-13T23:16:27.018Z","dependency_job_id":"59e3139b-aaba-41f4-93f3-bc88b92a2b6e","html_url":"https://github.com/kiwix/java-libkiwix","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiwix%2Fjava-libkiwix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiwix%2Fjava-libkiwix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiwix%2Fjava-libkiwix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiwix%2Fjava-libkiwix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kiwix","download_url":"https://codeload.github.com/kiwix/java-libkiwix/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253981760,"owners_count":21994330,"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":["java","kiwix","kotlin","libkiwix","zim"],"created_at":"2024-11-18T20:24:18.499Z","updated_at":"2025-05-13T16:31:21.707Z","avatar_url":"https://github.com/kiwix.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Libkiwix binding for Java/Kotlin\n================================\n\nLibrary for accessing [libkiwix](https://github.com/kiwix/libkiwix) and [libzim](https://github.com/openzim/libzim/) with Java or Kotlin on Android.\n\n[![Maven Central](https://img.shields.io/maven-central/v/org.kiwix/libkiwix)](https://search.maven.org/artifact/org.kiwix/libkiwix)\n[![Build Status](https://github.com/kiwix/java-libkiwix/workflows/CI/badge.svg?query=branch%3Amain)](https://github.com/kiwix/java-libkiwix/actions?query=workflow%3ACI+branch%3Amain)\n[![Continuous Deployment](https://github.com/kiwix/java-libkiwix/workflows/CD/badge.svg?query=branch%3Amain)](https://github.com/kiwix/java-libkiwix/actions?query=workflow%3ACD+branch%3Amain)\n[![CodeFactor](https://www.codefactor.io/repository/github/kiwix/java-libkiwix/badge)](https://www.codefactor.io/repository/github/kiwix/java-libkiwix)\n[![Codecov](https://codecov.io/gh/kiwix/java-libkiwix/branch/main/graph/badge.svg)](https://codecov.io/gh/kiwix/java-libkiwix)\n[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n\n# Build\n\nThe project requires `Java 17` to compile, Therefore set the `Gradle JDK` to `Java 17`.\n\n## Install dependencies\n```bash\n./install_deps.sh\n```\n\n## Compile\n```bash\n./gradlew buildHeaders\n./gradlew build\n```\n\nAAR file will be generated in directory `lib/build/outputs/aar`\n\n### Use the library in your project\n\nFirst, locate the compiled/generated `lib-debug.aar` in the\n`lib/build/outputs/aar` directory. Then open your project's Gradle\nconfiguration file and import the .aar file as a dependency.\n\nIf you are using Kotlin for your Gradle file, add the following code snippet:\n\n```kotlin\ndependencies {\n    implementation(files(\"path-of-aar-file/lib-debug.aar\"))\n}\n```\n\nIf you are using Groovy for your Gradle file, use this code snippet:\n\n```kotlin\ndependencies {\n    implementation files(\"path-to-your-aar-file/lib-debug.aar\")\n}\n```\n\n### Load ZIM file\n\nTo load a ZIM file you need to create an `Archive` object.\n\n```kotlin\nval archive = Archive(\"your-file-path\")\n```\n\n### Load ZIM main page\n\nThe `mainPage` property is used to retrieve the path of the main entry\npage for a Kiwix content archive.  If the main entry is a redirect, it\nwill fetch the path of the redirected item; otherwise, it will return\nthe path of the main entry itself.  If the main entry is not found,\nthe archive will throw an `EntryNotFoundException`.\n\n```kotlin\nval mainPage: String?\n    get() =\n        try {\n            archive.mainEntry.getItem(true).path\n        } catch (entryNotFoundException: EntryNotFoundException) {\n            // Return `null` if the main entry is not present in the archive.\n            null\n        } catch (exception: Exception) {\n            // Other exception will thrown here e.g. the file is corrupted or any other error happened.\n            null\n        }\n```\n\n### Load a ZIM article via title\n\n```kotlin\n    try {\n        // If the article with the specified title exists in the archive,\n        // retrieve its path using the `getEntryByTitle` method.\n        archive.getEntryByTitle(title).path\n    } catch (entryNotFoundException: EntryNotFoundException) {\n        // If the article with the specified title does not exist in the archive,\n        // return `null`.\n        null\n    }\n```\n\n### Load a ZIM article via path\n\nEnsure that the URL path is properly decode before passing it to `hasEntryByPath`,\nas `Libzim` does not support encoded URLs.\n\n```kotlin\n    val decodedPath = URLDecoder.decode(actualpath, \"UTF-8\")\n    try {\n        // If the article with the specified URL exists in the archive,\n        // retrieve its actual path using the `getEntryByPath` method.\n        archive.getEntryByPath(decodedPath)\n            .getItem(true)\n            .path\n    } catch (entryNotFoundException: EntryNotFoundException) {\n        // If the article with the specified URL does not exist in the archive,\n        // return `null`.\n        null\n    }\n```\n\n# License\n\n[GPLv3](https://www.gnu.org/licenses/gpl-3.0) or later, see\n[COPYING](COPYING) for more details.\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkiwix%2Fjava-libkiwix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkiwix%2Fjava-libkiwix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkiwix%2Fjava-libkiwix/lists"}