Javazip 简明教程

java.util.zip - ZipInputStream Class

Introduction

java.util.zip.ZipInputStream 类实现了用于读取 ZIP 文件格式中的文件的输入流过滤器。包括对压缩和非压缩文件的支持。

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

java.util.zip.ZipInputStream 类的声明如下所示:

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

public class ZipInputStream
   extends InflaterInputStream

Fields

java.util.zip.ZipInputStream 类的字段如下所示:

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

  1. static int CENATT

  2. static int CENATX

  3. static int CENCOM

  4. static int CENCRC

  5. static int CENDSK

  6. static int CENEXT

  7. static int CENFLG

  8. static int CENHDR

  9. static int CENHOW

  10. static int CENLEN

  11. static int CENNAM

  12. static int CENOFF

  13. static long CENSIG

  14. static int CENSIZ

  15. static int CENTIM

  16. static int CENVEM

  17. static int CENVER

  18. static int ENDCOM

  19. static int ENDHDR

  20. static int ENDOFF

  21. static long ENDSIG

  22. static int ENDSIZ

  23. static int ENDSUB

  24. static int ENDTOT

  25. static int EXTCRC

  26. static int EXTHDR

  27. static int EXTLEN

  28. static long EXTSIG

  29. static int EXTSIZ

  30. static int LOCCRC

  31. static int LOCEXT

  32. static int LOCFLG

  33. static int LOCHDR

  34. static int LOCHOW

  35. static int LOCLEN

  36. static int LOCNAM

  37. static long LOCSIG

  38. static int LOCSIZ

  39. static int LOCTIM

  40. 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 −

  1. java.util.zip.InflaterInputStream

  2. java.io.FilterInputStream

  3. java.lang.Object