Java ZIP Tutorial
Jakob Jenkov |
The Java ZIP API enables you to work with ZIP compression in your Java applications. This Java ZIP tutorial explains how the core classes of the Java ZIP API works. The Java ZIP compression API consists of several classes. Some of these classes are:
The Java ZipFile
class is used to work with ZIP files containing multiple files. This is useful
if you need to access the content of JAR or ZIP files.
The Java GZIPInputStream
and GZIPOutputStream
classes are used to ZIP compress a single
file. For instance, when returning a file from a web server, the web server can choose to ZIP compress it
before sending it to the client, to save bandwidth and increase download speed.
The above classes will be covered in detail their own tutorials (see the side menu for links).
By the way, I have used the Java GZIPOutputStream to create a Servlet filter that zip compresses all outgoing content. You can see all the code here:
Tweet | |
Jakob Jenkov |