6 Jul 2009

TrueZip your way across archives

Some of the open source projects receive instant success while some sink into oblivion. Brings one to the realization that running an open source project is not just about building the best frameworks but also about marketing and documenting it properly. (the latter is very important. Many developers casually assume that throwing in the Javadoc helps. No! Its really painful to wade through the javadocs unless you have the overview. You need to showcase atleast a "hello world" implementation or a "howto" FAQ for the early adopters)

Ruminations aside, I'd not heard of TrueZip before and would have skipped the page but for the nice one page howto on using it that made me realize that it was the perfect fit for one of the java projects I'd been working on

What was needed was a way to read/delete/modify archive contents (primarily zip). The challenge was that the archive contained multiple files within a directory hierarchy and all that was needed to do was modify one of them. Something like this.

So the target here is trying to read/write to the Config.xml file inside Folder1\Conf.

Java provides handy java.util.zip package for handling zip files but the architecture can be more or less awkward. After traversing the maze of javadocs and googling around, you'd somehow build a decent reader class but writing out modifications is a pain area.

Thats where TrueZip comes in. It acts as a Virtual File System allowing you to read/write your archive(zip) contents just as you would using normal File System classes in Java ( InputStream, Reader, Writer etc).

So for the former example all you need to do for reading and writing is open the corresponding reader/writer to this resource "Archive.zip\Folder1\Conf\config.xml"

Ah so simple. Isn't that what a good framework is supposed to do. Simplify things without building up additional complexity. And TrueZip does that with no extra brouhaha - no xml bloat, nor wiring of dependencies. Just a plain simple library solving a missing feature in the Java distribution. And it comes free under an "Apache2.0" license.


  1. christian_schlichtherleThursday, July 16, 2009 2:11:00 pm

    Thank you very much for blogging about TrueZIP.

    Greetz from its author.

  2. Thanks for writing such a cool piece of software & making it available for all ;-)