My question is relativly simple. Does anybody know a free library (LGPL) that is capable of unzipping a zipped file structure into a TreeMap (or a similar iteratable structure) for Java?
Point is, that I could do this myself, but I don’t want to reinvent already good riding wheels π
Thanks in advance!
So my thing is, that i have a zip file, containing multiple files and directories which may contain more files. What i am looking for is a convinient way how to extract this tree structure into an object graph, whether it’s a TreeMap or not. So for example: a HashMap : {'root' => 'HashMap : {'file1.png' => byte[] content}}
As I answered some time ago on another question, there is no single “tree” data structure (tree interface) in the Java API, since every use needs other features.
Your proposed HashMap-tree, for example, is not realizable in a type-save way – you would need wrapper objects somewhere.
I don’t know if somewhere out there is already a tree-like view of a zip file, to (not) answer your question, but it is not really difficult to create as soon as you define your wished tree interface.
So, here is an example class which does what you want (from what I understand).
It has a main method for test use, its output for one of my jar files is this:
(You’ll need an unicode-capable Terminal and an Unicode encoding for System.out, though.)