java.util.zip - ZipEntry Class


Advertisements


Introduction

The java.util.zip.ZipEntry class is used to represent a ZIP file entry.

Class declaration

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

public class ZipEntry
   extends Object
      implements Cloneable

Fields

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

  • protected byte[] buf − Output buffer for writing uncompressed data.

  • protected Inflater inf − Decompressor for this stream.

  • 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 DEFLATED − Compression method for compressed (deflated) entries.

  • 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

  • static int STORED − Compression method for uncompressed entries.

Constructors

Sr.No. Constructor & Description
1

ZipEntry(String name)

Creates a new zip entry with the specified name.

2

ZipEntry(ZipEntry e)

Creates a new zip entry with fields taken from the specified zip entry.

Class methods

Sr.No. Method & Description
1 Object clone()

Returns a copy of this entry.

2 String getComment()

Returns the comment string for the entry, or null if none.

3 long getCompressedSize()

Returns the size of the compressed entry data, or -1 if not known.

4 long getCrc()

Returns the CRC-32 checksum of the uncompressed entry data, or -1 if not known.

5 byte[] getExtra()

Returns the extra field data for the entry, or null if none.

6 int getMethod()

Returns the compression method of the entry, or -1 if not specified.

7 String getName()

Returns the name of the entry.

8 long getSize()

Returns the uncompressed size of the entry data, or -1 if not known.

9 long getTime()

Returns the modification time of the entry, or -1 if not specified.

10 int hashCode()

Returns the hash code value for this entry.

11 boolean isDirectory()

Returns true if this is a directory entry.

12 void setComment(String comment)

Sets the optional comment string for the entry.

13 void setCrc(long crc)

Sets the CRC-32 checksum of the uncompressed entry data.

14 void setExtra(byte[] extra)

Sets the optional extra field data for the entry.

15 void setMethod(int method)

Sets the compression method for the entry.

16 void setSize(long size)

Sets the uncompressed size of the entry data.

17 void setTime(long time)

Sets the modification time of the entry.

18 String toString()

Returns a string representation of the ZIP entry.

Methods inherited

This class inherits methods from the following classes −

  • java.io.FilterOutputStream
  • java.lang.Object


Advertisements