Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Zip size...

Status
Not open for further replies.

jstreich

Programmer
Apr 20, 2002
1,067
US
I've got 3 files that define a 2D map with several layers. The files are simple ASCII text, and they are being zipped together while being output via a ZipOutputStream. The resulting zip is larger than the 3 files would be otherwise for smaller files. I haven't used my program enough to see what it does for more information, but I am wondering possible causes for the larger files -- ascii text should compress fairly well and there is a lot of repeation in the largest of the three files.

Any ideas?

[plug=shameless]
[/plug]
 
Open the file with WinZip, that will show you the details of which files are being zipped and the compression ratio.

Cheers,
Dian
 
1. I know what files are being zipped.
2. I don't have winzip, as I'm working in Linux.
3. The files aren't real files untill unzipped... They are starting out being written as char data to a ZipOutput stream.

The Three files (unzipped are sizes):
41 tiles
32 tokens
207 map

The Zip file is:
405 testmap.zip

What I'm really wondering is really:
1. Is the difference really just the zip overhead (which would remain about constant even with the bigger files for which the compression would be better)?
2. Or is this a product of the PrintWriter's autoflush causing the compression stream to attempt to find patterns in smaller sized files?

[plug=shameless]
[/plug]
 
Ah, found the answer... It's the fact that they are several smaller files. Larger files compress better with ZIP format. So, it will scale better than I thought :) .

[plug=shameless]
[/plug]
 
Yeah, that's just a snipped up version of an ls. The zip entries and the manifest seem big in comparison to the small files, but with larger files, you can see the compression has an effect. The maps will be a lot larger, and the files will be too. Plus the compression wasn't my main reason for using the zip stream, but the ability to have the 3 logical files in same physical file in a mannor that was fairly standard. The compression will be important later on, though.

... Er. I'm ranting or babbling... sorry.

[plug=shameless]
[/plug]
 
Use a DeflatorOutputStream (PKZIP alg) with small files - the compression ratio is much better.

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
If the files are that small, only the CRC (32 bytes)will make the compression useless.

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top