Basic RPM Parser Java for GZIP RPMs This is mosty based on Kaitai Struct's RPM parser but I also write some example code. It is not as large as RPMJ but is less bloated, only requiring cpio-java https://pagure.io/cpio-java and Kaitai Struct https://github.com/kaitai-io/kaitai_struct_java_runtime/tree/e34e5a9b4d3e02a323fdbb000b61d0dd0fb9f776 and any other compression library you want.
Due to the closure of Pagure.io, as discussed here: https://discussion.fedoraproject.org/t/decommissioning-of-pagure-io-anticipated-by-flock-2026/181997, this project has been moved from Pagure to GitHub: