Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.util.zip

Class ZipInputStream

java.lang.Object
|
+--java.io.InputStream
   |
   +--java.io.FilterInputStream
      |
      +--java.util.zip.InflaterInputStream
         |
         +--java.util.zip.ZipInputStream

All Implemented Interfaces:

java.util.zip.ZipConstants


public class ZipInputStream

extends InflaterInputStream

implements java.util.zip.ZipConstants

This is a FilterInputStream that reads the files in an zip archive one after another. It has a special method to get the zip entry of the next file. The zip entry contains information about the file name size, compressed size, CRC, etc. It includes support for STORED and DEFLATED entries.

Author:

Constructor Summary

ZipInputStream(java.io.InputStream in)

Creates a new Zip input stream, reading a zip archive.

Method Summary

intavailable()

voidclose()

Closes the zip file.
voidcloseEntry()

Closes the current zip entry and moves to the next one.
java.util.zip.ZipEntrycreateZipEntry(java.lang.String name)

Creates a new zip entry for the given name.
java.util.zip.ZipEntrygetNextEntry()

Open the next entry from the zip archive, and return its description.
intread()

Reads a byte from the current zip entry.
intread(byte[] b, int off, int len)

Reads a block of bytes from the current zip entry.

Constructor Details

ZipInputStream

public ZipInputStream(java.io.InputStream in)

Creates a new Zip input stream, reading a zip archive.

Parameters:


Method Details

available

public int available()


close

public void close()

Closes the zip file.

Throws:


closeEntry

public void closeEntry()

Closes the current zip entry and moves to the next one.


createZipEntry

protected ZipEntry createZipEntry(java.lang.String name)

Creates a new zip entry for the given name. This is equivalent to new ZipEntry(name).

Parameters:


getNextEntry

public ZipEntry getNextEntry()

Open the next entry from the zip archive, and return its description. If the previous entry wasn't closed, this method will close it.


read

public int read()

Reads a byte from the current zip entry.

Returns:

Throws:


read

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

Reads a block of bytes from the current zip entry.

Parameters:

Returns:

Throws: