TChilkatZipEntry2 Delphi Reference

TChilkatZipEntry2

Represents a single file or directory entry within a Chilkat Zip object.

Object Creation

var
obj: IChilkatZipEntry2;
...
begin
// This object is never created outright.
// It is returned by various TChilkatZip2 methods.
obj := zipObject.someMethod(...);

Properties

property Comment: WideString

The comment stored within the Zip for this entry.

property CompressedLength: Integer readonly

The size of this file when Zip compression is applied

property CompressionLevel: Integer

The compression level. 0 = no compression, while 9 = maximum compression. The default is 6.

property CompressionMethod: Integer

Set to 0 for no compression, or 8 for the Deflate algorithm. The Deflate algorithm is the default algorithm of the most popular Zip utility programs, such as WinZip

property Crc: Integer readonly

The CRC for the zip entry.

property EntryID: Integer readonly

The unique ID assigned by Zip.NET while the object is instantiated in memory.

property EntryType: Integer readonly

Indicates the origin of the entry. There are three possible values: (0) a file on disk referenced by Zip.NET and to be added to the Zip, (1) an entry in an existing Zip file, and (2) an entry created directly from data in memory.

property FileDateTime: TDateTime

The last-modified time of the Zip entry.

property FileName: WideString

The file name of the Zip entry.

property InternalId: Integer readonly

To be documented soon...

property IsDirectory: Integer readonly

True if the Zip entry is a directory, false if it is a file.

property LastErrorHtml: WideString readonly

Error information in HTML format for the last method called.

property LastErrorText: WideString readonly

Error information in plain-text format for the last method called.

property LastErrorXml: WideString readonly

Error information in XML format for the last method called.

property UncompressedLength: Integer readonly

The size in bytes of the Zip entry when uncompressed.

Methods

procedure AppendData(data: OleVariant);

Append text or binary data to a file within a Zip archive

function Copy(): OleVariant;

Returns the compressed data as a byte array.

Returns 1 for success, 0 for failure.

function CopyToBase64(): WideString;

Returns the compressed data as a Base64-encoded string. This data can be re-added to a Zip by calling Zip.AppendBase64.

Returns a null on failure

function CopyToHex(): WideString;

Returns the compressed data as a hexidecimal encoded string. This data can be re-added to a Zip by calling Zip.AppendHex.

Returns a null on failure

function Extract(dirPath: WideString): Integer;

Unzips this entry into the specified base directory. The file is unzipped to the subdirectory according to the relative path stored with the entry in the Zip. Use ExtractInto to unzip into a specific directory regardless of the path information stored in the Zip.

function ExtractInto(dirPath: WideString): Integer;

Unzip a file into a specific directory

function Inflate(): OleVariant;

Inflate a file within a Zip directly into memory.

Returns 1 for success, 0 for failure.

function InflateToString(addCR: Integer): WideString;

Inflate and return the uncompressed data as a string. Line-endings are modified to include or not include carriage-returns based on KeepCR. If KeepCR = False, then bare linefeeds are returned, otherwise CRLFs are returned.

Returns a null on failure

function InflateToString2(): WideString;

Unzip a file directly into memory as a string, and leave line-endings unmodified.

Returns a null on failure

function InflateToString3(srcCharset: WideString): WideString;

Inflates a character data from a specified character encoding (such as iso-8859-1, or Shift_JIS) and returns the inflated data as a Unicode string.

Returns a null on failure

function NextEntry(): TChilkatZipEntry2;

Return the next entry (file or directory) within the Zip

Returns a null reference on failure

procedure ReplaceData(data: OleVariant);

Replace the contents of a file within a Zip archive

procedure SaveLastError(filename: WideString);

Saves the last error information to an XML formatted file.