---
schema_version: "1"
id: ec4ecf4d4d85a36a0f1b865c1177bd0479aa74a38259d26c1b3d0ebc45fb0888
title: ZipEntry Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_class_compression_zipentry.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_compression_zipentry.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 25f8c159b943a00fe7db9a355027330a2db2c64290c0f20355a85868516e12c6
description: Contains methods to get and set information about a zip file entry.Compares this object with the specified object and returns true if both objects are equal; otherwise, returns false.Returns the hash code value for the zip entry.Gets the comment string for the zip entry.Gets the size in bytes of the compressed zip entry.Gets the content of the zip entry. This method doesn’t work with the ZipReader class.Gets the cyclic redundancy check (CRC) value for the zip entry.Gets the last modification timestamp of the zip entry.Gets the compression method of the zip entry.Gets the name of the zip entry.Gets the uncompressed size in bytes of the zip entry content.Sets the comment string for the zip entry that’s written to the Zip archive. This method doesn’t work with the ZipReader class.Sets the content of the zip entry that’s written to the Zip archive. This method doesn’t work with the ZipReader class.Sets the last modification time of the zip entry that’s written to the Zip archive. This method doesn’t work with the ZipReader class.Sets the compression method for the zip entry that’s written to the zip archive. This method doesn’t work with the ZipReader class.Returns a string representation of the zip entry.
---
# ZipEntry Class

Contains methods to get and set information about a zip file entry.

## Namespace

[Compression](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_namespace_compression.htm "The Compression namespace provides classes and methods to create and extract zip files.")

- **[ZipEntry Methods](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_compression_zipentry.htm#apex_compression_zipentry_methods)**

## ZipEntry Methods

The following are methods for ZipEntry.

- **[equals(obj)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_compression_zipentry.htm#apex_compression_zipentry_equals)**  
    Compares this object with the specified object and returns true if both objects are equal; otherwise, returns false.
- **[hashcode()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_compression_zipentry.htm#apex_compression_zipentry_hashcode)**  
    Returns the hash code value for the zip entry.
- **[getComment()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_compression_zipentry.htm#apex_compression_zipentry_getComment)**  
    Gets the comment string for the zip entry.
- **[getCompressedSize()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_compression_zipentry.htm#apex_compression_zipentry_getCompressedSize)**  
    Gets the size in bytes of the compressed zip entry.
- **[getContent()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_compression_zipentry.htm#apex_compression_zipentry_getContent)**  
    Gets the content of the zip entry. This method doesn’t work with the ZipReader class.
- **[getCrc()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_compression_zipentry.htm#apex_compression_zipentry_getCrc)**  
    Gets the cyclic redundancy check (CRC) value for the zip entry.
- **[getLastModifiedTime()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_compression_zipentry.htm#apex_compression_zipentry_getLastModifiedTime)**  
    Gets the last modification timestamp of the zip entry.
- **[getMethod()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_compression_zipentry.htm#apex_compression_zipentry_getMethod)**  
    Gets the compression method of the zip entry.
- **[getName()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_compression_zipentry.htm#apex_compression_zipentry_getName)**  
    Gets the name of the zip entry.
- **[getUncompressedSize()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_compression_zipentry.htm#apex_compression_zipentry_getUncompressedSize)**  
    Gets the uncompressed size in bytes of the zip entry content.
- **[setComment(comment)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_compression_zipentry.htm#apex_compression_zipentry_setComment)**  
    Sets the comment string for the zip entry that’s written to the Zip archive. This method doesn’t work with the ZipReader class.
- **[setContent(blob)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_compression_zipentry.htm#apex_compression_zipentry_setContent)**  
    Sets the content of the zip entry that’s written to the Zip archive. This method doesn’t work with the ZipReader class.
- **[setLastModifiedTime(modTime)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_compression_zipentry.htm#apex_compression_zipentry_setLastModifiedTime)**  
    Sets the last modification time of the zip entry that’s written to the Zip archive. This method doesn’t work with the ZipReader class.
- **[setMethod(method)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_compression_zipentry.htm#apex_compression_zipentry_setMethod)**  
    Sets the compression method for the zip entry that’s written to the zip archive. This method doesn’t work with the ZipReader class.
- **[toString()](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_compression_zipentry.htm#apex_compression_zipentry_toString)**  
    Returns a string representation of the zip entry.

### equals(obj)

Compares this object with the specified object and returns true if both objects are equal; otherwise, returns false.

#### Signature

public Boolean equals(Object obj)

#### Parameters

- **obj**: Type: Object

#### Return Value

Type: [Boolean](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_boolean.htm#apex_methods_system_boolean "Contains methods for the Boolean primitive data type.")

### hashcode()

Returns the hash code value for the zip entry.

#### Signature

public Integer hashcode()

#### Return Value

Type: [Integer](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_integer.htm#apex_methods_system_integer "Contains methods for the Integer primitive data type.")

### getComment()

Gets the comment string for the zip entry.

#### Signature

public string getComment()

#### Return Value

Type: [string](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")

### getCompressedSize()

Gets the size in bytes of the compressed zip entry.

#### Signature

public long getCompressedSize()

#### Return Value

Type: [long](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_long.htm#apex_methods_system_long "Contains methods for the Long primitive data type.")

### getContent()

Gets the content of the zip entry. This method doesn’t work with the ZipReader class.

#### Signature

public blob getContent()

#### Return Value

Type: [blob](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_blob.htm#apex_methods_system_blob "Contains methods for the Blob primitive data type.")

### getCrc()

Gets the cyclic redundancy check (CRC) value for the zip entry.

#### Signature

public long getCrc()

#### Return Value

Type: [long](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_long.htm#apex_methods_system_long "Contains methods for the Long primitive data type.")

### getLastModifiedTime()

Gets the last modification timestamp of the zip entry.

#### Signature

public Datetime getLastModifiedTime()

#### Return Value

Type: [Datetime](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_datetime.htm#apex_methods_system_datetime "Contains methods for the Datetime primitive data type.")

### getMethod()

Gets the compression method of the zip entry.

#### Signature

public Compression.Method getMethod()

#### Return Value

Type: [Compression.Method](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_enum_compression_Method.htm "Specifies the compression method for the zip entries.")

Uses values from the Method enum and indicates whether the zip entry has DEFLATED or STORED method.

### getName()

Gets the name of the zip entry.

#### Signature

public string getName()

#### Return Value

Type: [string](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")

### getUncompressedSize()

Gets the uncompressed size in bytes of the zip entry content.

#### Signature

public long getUncompressedSize()

#### Return Value

Type: [long](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_long.htm#apex_methods_system_long "Contains methods for the Long primitive data type.")

### setComment(comment)

Sets the comment string for the zip entry that’s written to the Zip archive. This method doesn’t work with the ZipReader class.

#### Signature

public Compression.ZipEntry setComment(String comment)

#### Parameters

- **comment**: Type: [String](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")

#### Return Value

Type: [Compression.ZipEntry](#apex_class_compression_zipentry "Contains methods to get and set information about a zip file entry.")

### setContent(blob)

Sets the content of the zip entry that’s written to the Zip archive. This method doesn’t work with the ZipReader class.

#### Signature

public Compression.ZipEntry setContent(Blob blob)

#### Parameters

- **blob**: Type: [Blob](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_blob.htm#apex_methods_system_blob "Contains methods for the Blob primitive data type.")

#### Return Value

Type: [Compression.ZipEntry](#apex_class_compression_zipentry "Contains methods to get and set information about a zip file entry.")

### setLastModifiedTime(modTime)

Sets the last modification time of the zip entry that’s written to the Zip archive. This method doesn’t work with the ZipReader class.

#### Signature

public Compression.ZipEntry setLastModifiedTime(Datetime modTime)

#### Parameters

- **modTime**: Type: [Datetime](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_datetime.htm#apex_methods_system_datetime "Contains methods for the Datetime primitive data type.")

#### Return Value

Type: [Compression.ZipEntry](#apex_class_compression_zipentry "Contains methods to get and set information about a zip file entry.")

### setMethod(method)

Sets the compression method for the zip entry that’s written to the zip archive. This method doesn’t work with the ZipReader class.

#### Signature

public Compression.ZipEntry setMethod(Compression.Method method)

#### Parameters

- **method**: Type: [Compression.Method](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_enum_compression_Method.htm "Specifies the compression method for the zip entries.") Uses the Method enum values and sets the compression method as DEFLATED or STORED.

#### Return Value

Type: [Compression.ZipEntry](#apex_class_compression_zipentry "Contains methods to get and set information about a zip file entry.")

### toString()

Returns a string representation of the zip entry.

#### Signature

public string toString()

#### Return Value

Type: [string](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_string.htm#apex_methods_system_string "Contains methods for the String primitive data type.")