Java ZIP Tutorial

Jakob Jenkov
Last update: 2017-11-02

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:

Java ZIP Compression Servlet Filter

Jakob Jenkov

Featured Videos

Java ForkJoinPool

P2P Networks Introduction


Java Persistence
Close TOC
All Tutorial Trails
All Trails
Table of contents (TOC) for this tutorial trail
Trail TOC
Table of contents (TOC) for this tutorial
Page TOC
Previous tutorial in this tutorial trail
Next tutorial in this tutorial trail