Skip to content

ZipEntry

cthackers edited this page Feb 28, 2012 · 2 revisions

The ZipEntry is more than a structure representing the entry inside the zip file. Beside the normal attributes and headers a entry can have, the class contains a reference to the part of the file where the compressed data resides and decompresses it when requested. It also compresses the data and creates the headers required to write in the zip file.

[String] String entryName

entryName represents the full name and path of the file

[String] name

Read-Only property that returns the basename of the entry.

[Buffer] Buffer extra

Extra data associated with this entry

[String] String comment

Entry comment

[Boolean] isDirectory

Read-Only property that indicates the type of the entry

[Buffer] Buffer compressedData

When setting compressedData, the LOC Data Header must also be present at the beginning of the Buffer. If the compressedData was set for a ZipEntry anf no other change was made to its properties (comment, extra etc), reading this property will return the same value. If changes had been made, reading this property will recompress the data and recreate the entry headers.

If no compressedData was specified, reading this property will compress the data and create the required headers.

The output of the compressedData Buffer contains the LOC Data Header

[Buffer] Buffer data

Set uncompressed data to the entry to be compressed and read from the compressedData property. If no data was specified, reading this property will decompress the Buffer set at compressedData

[EntryHeader] Buffer header

Writing to this property requires a valid CEN Entry Header Buffer read from the central directory file header from the zip. Reading this property will return a EntryHeader object

[Buffer] packHeader( )

Returns the CEN Entry Header to be written in the output zip file plus the extra data and the entry comment

[String] toString( )

Returns a nicely formatted string with the most important properties of the ZipEntry