General Java Questions IV
Visit us here and  you will find
much more tips!
Receive our  newsletter with new tips!  Almost 6,000 subscribers (by June 2001) can not be wrong! 
They read our tips every week! 
 To subscribe to The Java FAQ Daily send empty e mail to:
javafaq tips subscribe@topica.com
  or visit at:
http://www.topica.com/lists/javafaq tips/
 General Java Questions IV
 Q: I am looking for more efficient compression APIs esp. for *.doc and *.html
files.
I need some Java APIs wherein I can implement various compression algorithms. I
have already the GZIP compression technique shipped with JDK s java.util.zip
package. I am looking for more efficient compression APIs esp. for *.doc and *.html
files.
Answer: You often get better compression results for a large number of smaller files
by concatenating the uncompressed files and then compressing the result. That s
why tar.gz is often superior to zip for large numbers of html files (like API docs).
You will not get much better general purpose compression than Zip, at least not until
you have a specific class of data and know very much about its structure. Even then
you ll need some experience and time working on a better compression method.
You might want to take a look at this Java implementation of bzip2:
http://www.aftexsw.com/aftex/products/java/bzip/
It uses more CPU cycles and memory but typically compresses better
than zip.
  
Marco
 Q: I need to programmatically replace an entry in a zip file.
I could not quite get it using the ZipOutputStream because it simply creates a new
file and write only that entry for me. The rest of the original entries are gone. 
Does anyone have a solution for this?
Answer:
1) Read the file (myfile.properties) out of the original Zip Archive (original.zip)
2) Make your changes, write the file to the file system
3) Create a New Archive (originalNew.zip)
4) Write your edited file (myfile.properties) to originalNew.zip
5) loop through all the entries in the original Zip archive (original.zip),  adding them to
the new archive (originalNew.zip) EXCEPT for the file you are replacing
file:///F|/a_jsite/350_tips/general_java IV.htm (1 of 10) [2001 07 08 11:24:54]






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java web hosting

 

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved