TrueZip compresses as you add, but does not construct the final archive file until you call umount. Using the default settings, TrueZip archives take up about an extra 28% more space that WinZip using its proprietary compression algorithms. It possible to squeeze more compression out of TrueZip if you are willing to take more time.
See the timestamp gotchas about PkZip format. They plague TrueZip too. TrueZip can use other formats that may avoid these problems.
Java 7 will have built-in True-zip like features. Mark Hall is working on giving TrueZip an API (Application Programming Interface) that will be compatible. That means you can write code for Java 7 that will work on earlier JDKs.
TrueZip 7 is a rewrite of TrueZip 6 with a slightly different API.
TrueZip 6 works onJava version 1.4 or later. TrueZip 7 works onJava version 1.6 or later.
TrueZip supports to following flavours of archive:
| Archive Formats that TrueZip supports | ||||
|---|---|---|---|---|
| Type | Canonical Suffixes | Description | Advantages | Disadvantages |
| ZIP | zip | ZIP file: Archive file with central directory and compressible entries |
Widely supported. People can easily access the archive without TrueZip. Uses standard Java java.util.zip.Deflater to do the actual compression, which is also a disadvantage because it is not a particularly quick or strong. You can trade off time for additional compression. | Incompetent date-time stamp format. They don't understand time zones or daylight saving. They are only accurate to two seconds. |
| JAR | ear ❘ jar ❘ war | Java Archive: ZIP with custom directory tree layout | Fully multiplatform because of Java support. | Uses rather lame compression techniques. Same advantages and disadvantages as zip. Jar is just a flavour of zip. |
| ODF | odb ❘ odf ❘ odg ❘ odm ❘ odp ❘ ods ❘ odt ❘ otg ❘ oth ❘ otp ❘ ots ❘ ott | OpenDocument Format, like XML (extensible Markup Language) compressed with PkZip. | Works with OpenOffice | Not a general format |
| TZP | tzp ❘ zip.rae ❘ zip.raes | RAES encrypted ZIP file | AES (Advanced Encryption Standard) is serious encryption. | Needs aux BouncyCastle bcprov.jar. Does not use JCE (Java Cryptography Extension) because JCE lacks the needed random access. |
| SFX/EXE | exe | ZIP file with a code preamble for self extraction | If you send the archive to someone, they need no additional software at all to open it. | This driver is pretty slow. Windows only. Read-only. |
| TAR (Tape Archive) | tar | TAR : Uncompressed tape archive file. | Universally supported under Unix. | Needs aux ant.jar. |
| TAR.BZ | tbz ❘ tb2 ❘ tar.bz2 | TAR file wrapped in BZIP2 compression format | More aggressive compression than ZIP. | Needs aux ant.jar. |
| TAR.GZ | tar.gz ❘ tgz | TAR file wrapped in GZIP compression format. | Traditional Unix archive | Not particularly aggressive compression. Needs aux ant.jar. |
Here is a simple program to add a file to a zip and display a directory of its contents.
Here is a simple program to add a file to a zip and display a directory of its contents.
ZIP files use IBM437, an eight bit character set to encode the filenames. Anything which is not representable in this charset gets rejected. You can change this in the File API and the ZIP API. For the File API, just do this:
Another way to do it is to create an empty zip file using ZipOutputStream with a specified encoding.
However, this will stop interoperability of the created ZIP files with older tools because support for UTF-8 has been added only fairly recently! So anybody else will probably not be able to extract these ZIP files. WinZip, however, can handle them.
If you need a better option, use the JAR file format — it supports UTF-8. The TAR file format is not an option either because it supports only US-ASCII.
|
|
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 | |
![]() | ||
| Canadian Mind Products | ||
| mindprod.com IP:[65.110.21.43] | ||
| view Blog | Your face IP:[38.107.179.211] | |
| Feedback | You are visitor number 11. | |