java.util.zip - ZipInputStream Class


Advertisements

Introduction

The java.util.zip.ZipInputStream class implements an input stream filter for reading files in the ZIP file format. Includes support for both compressed and uncompressed entries.

Class declaration

Following is the declaration for java.util.zip.ZipInputStream class −

public class ZipInputStream
   extends InflaterInputStream

Fields

Following are the fields for java.util.zip.ZipInputStream class −

  • static int CENATT

  • static int CENATX

  • static int CENCOM

  • static int CENCRC

  • static int CENDSK

  • static int CENEXT

  • static int CENFLG

  • static int CENHDR

  • static int CENHOW

  • static int CENLEN

  • static int CENNAM

  • static int CENOFF

  • static long CENSIG

  • static int CENSIZ

  • static int CENTIM

  • static int CENVEM

  • static int CENVER

  • static int ENDCOM

  • static int ENDHDR

  • static int ENDOFF

  • static long ENDSIG

  • static int ENDSIZ

  • static int ENDSUB

  • static int ENDTOT

  • static int EXTCRC

  • static int EXTHDR

  • static int EXTLEN

  • static long EXTSIG

  • static int EXTSIZ

  • static int LOCCRC

  • static int LOCEXT

  • static int LOCFLG

  • static int LOCHDR

  • static int LOCHOW

  • static int LOCLEN

  • static int LOCNAM

  • static long LOCSIG

  • static int LOCSIZ

  • static int LOCTIM

  • static int LOCVER

Constructors

Sr.No. Constructor & Description
1

ZipInputStream(InputStream in)

Creates a new ZIP input stream.

2

ZipInputStream(InputStream in, Charset charset)

Creates a new ZIP input stream.

Class methods

Sr.No. Method & Description
1 int available()

Returns 0 after EOF has reached for the current entry data, otherwise always return 1.

2 void close()

Closes this input stream and releases any system resources associated with the stream.

3 void closeEntry()

Closes the current ZIP entry and positions the stream for reading the next entry.

4 ZipEntry getNextEntry()

Reads the next ZIP file entry and positions the stream at the beginning of the entry data.

5 int read(byte[] b, int off, int len)

Reads from the current ZIP entry into an array of bytes.

6 long skip(long n)

Skips specified number of bytes in the current ZIP entry.

Methods inherited

This class inherits methods from the following classes −

  • java.util.zip.InflaterInputStream
  • java.io.FilterInputStream
  • java.lang.Object
Print