TrueZip : Java Glossary

go to home page T words local find full screen, hide local find menu Google search web for more information on this topic jump to foot of page translate this page with Babelfish punctuation 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z (all) ©1996-2009 2009-05-16 Roedy Green, Canadian Mind Products
TrueZip
is a Java library that lets you treat a zip file as if it were a directory. You can shuffle files around and when you are done, call umount() which creates a new zip reflecting all your changes.
TrueZip gives you complete flexibility in just how much qualification you include with each member. You can have none, full qualification, anything in between, or even include the original drive letter (which maps into a subdirectory called E: for example). It is up to you as a programmer to construct the file name of the zip entry, then pour your file/files into it. The name does not even have to bear any resemblance to the name of the file you are adding. You can’t just copy files into the root of the archive. You must first create a a zip entry file with a name to contain each one. It behaves much more like a directory tree than a traditional archive.

TrueZip compresses as you add, but does not construct the final archive file until you call umount. TrueZip takes about an extra 28% more space that WinZip using its proprietary compression algorithms.

See the timestamp gotchas about PKZIP format. They plague TrueZip too. TrueZip can use other formats that may avoid these problems.

Sample Code

Here is a minimal program to add an element to a zip file.

BackupToZip Substantial Truezip Application

Here is the source code for a more complex TrueZip program that maintains a mirror of a set of files in an archive zip, keeping it up to date by deleting, adding or updating the achive members as needed. You can download it or read the documentation.

ANT/Genjar

It is fairly tricky to bundle just the parts of the truezip jar that you need inside your own jar. Here is how you do it with ANT/GenJar.

CMP homejump to top You can get the freshest copy of this page from: or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror)
http://mindprod.com/jgloss/truezip.html J:\mindprod\jgloss\truezip.html
CMP logofeedback Please email your feedback for publication, errors, omissions, typos, formatting errors, ambiguities, unclear wording, broken/redirected link reports, suggestions to improve this page or comments to Roedy Green : feedback email
mindprod.com IP:[65.110.21.43]
view BlogYour face IP:[38.107.191.101]
You are visitor number 11.