ZipEntry 

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 −

publicclassZipEntryextendsObjectimplementsCloneable

Learn Java in-depth with real-world projects through our Java certification course. Enroll and become a certified expert to boost your career.

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
1ZipEntry(String name)Creates a new zip entry with the specified name.
2ZipEntry(ZipEntry e)Creates a new zip entry with fields taken from the specified zip entry.

Class Methods

Sr.No.Method & Description
1Object clone()Returns a copy of this entry.
2String getComment()Returns the comment string for the entry, or null if none.
3long getCompressedSize()Returns the size of the compressed entry data, or -1 if not known.
4long getCrc()Returns the CRC-32 checksum of the uncompressed entry data, or -1 if not known.
5byte[] getExtra()Returns the extra field data for the entry, or null if none.
6int getMethod()Returns the compression method of the entry, or -1 if not specified.
7String getName()Returns the name of the entry.
8long getSize()Returns the uncompressed size of the entry data, or -1 if not known.
9long getTime()Returns the modification time of the entry, or -1 if not specified.
10int hashCode()Returns the hash code value for this entry.
11boolean isDirectory()Returns true if this is a directory entry.
12void setComment(String comment)Sets the optional comment string for the entry.
13void setCrc(long crc)Sets the CRC-32 checksum of the uncompressed entry data.
14void setExtra(byte[] extra)Sets the optional extra field data for the entry.
15void setMethod(int method)Sets the compression method for the entry.
16void setSize(long size)Sets the uncompressed size of the entry data.
17void setTime(long time)Sets the modification time of the entry.
18String 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

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *