ZipEntry C Library Reference

ZipEntry

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

Create/Dispose

HCkZipEntry CkZipEntry_Create(void);

Creates an instance of the CkZipEntry object and returns a handle (i.e. a "void *" pointer). The handle is passed in the 1st argument for the functions listed on this page.

void CkZipEntry_Dispose(HCkZipEntry handle);

Objects created by calling CkZipEntry_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function.

C "Properties"

void CkZipEntry_getComment(HCkZipEntry cHandle, HCkString retval);
void CkZipEntry_putComment(HCkZipEntry cHandle, const char *newVal);

The comment stored within the Zip for this entry.

unsigned long CkZipEntry_getCompressedLength(HCkZipEntry cHandle);

The size in bytes of this entry's file data when compression is applied

long CkZipEntry_getCompressionLevel(HCkZipEntry cHandle);
void CkZipEntry_putCompressionLevel(HCkZipEntry cHandle, long newVal);

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

long CkZipEntry_getCompressionMethod(HCkZipEntry cHandle);
void CkZipEntry_putCompressionMethod(HCkZipEntry cHandle, long newVal);

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

int CkZipEntry_getCrc(HCkZipEntry cHandle);

The CRC for the zip entry.

long CkZipEntry_getEntryID(HCkZipEntry cHandle);

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

long CkZipEntry_getEntryType(HCkZipEntry cHandle);

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

void CkZipEntry_getFileDateTime(HCkZipEntry cHandle, SYSTEMTIME *retval);
void CkZipEntry_putFileDateTime(HCkZipEntry cHandle, SYSTEMTIME *newVal);

The last-modified time of the Zip entry.

void CkZipEntry_getFileName(HCkZipEntry cHandle, HCkString retval);
void CkZipEntry_putFileName(HCkZipEntry cHandle, const char *newVal);

The file name of the Zip entry.

BOOL CkZipEntry_getIsDirectory(HCkZipEntry cHandle);

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

void CkZipEntry_getLastErrorHtml(HCkZipEntry cHandle, HCkString retval);

Error information in HTML format for the last method called.

void CkZipEntry_getLastErrorText(HCkZipEntry cHandle, HCkString retval);

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

void CkZipEntry_getLastErrorXml(HCkZipEntry cHandle, HCkString retval);

Error information in XML format for the last method called.

unsigned long CkZipEntry_getUncompressedLength(HCkZipEntry cHandle);

The size in bytes of this entry's file data when uncompressed.

BOOL CkZipEntry_getUtf8(HCkZipEntry cHandle);
void CkZipEntry_putUtf8(HCkZipEntry cHandle, BOOL newVal);

When set to true, all "const char *" arguments are expected to be utf-8 strings. If set to false, the "const char *" arguments are expected to be ANSI strings.

C "Methods"

BOOL CkZipEntry_AppendData(HCkZipEntry cHandle, HCkByteData bdata);

Appends binary data to the zip entry's file contents.

BOOL CkZipEntry_AppendStringAnsi(HCkZipEntry cHandle, HCkString sdata);

Appends a ANSI string to the zip entry's file contents.

BOOL CkZipEntry_Copy(HCkZipEntry cHandle, HCkByteData outData);

Returns the compressed data as a byte array.

BOOL CkZipEntry_CopyToBase64(HCkZipEntry cHandle, HCkString outStr);

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

BOOL CkZipEntry_CopyToHex(HCkZipEntry cHandle, HCkString outStr);

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

BOOL CkZipEntry_Extract(HCkZipEntry cHandle, const char *dirPath);

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.

BOOL CkZipEntry_ExtractInto(HCkZipEntry cHandle, const char *dirPath);

Unzip a file into a specific directory

BOOL CkZipEntry_Inflate(HCkZipEntry cHandle, HCkByteData outData);

Inflate a file within a Zip directly into memory.

BOOL CkZipEntry_InflateToString(HCkZipEntry cHandle, BOOL addCR, HCkString outStr);

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.

BOOL CkZipEntry_InflateToString2(HCkZipEntry cHandle, HCkString outStr);

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

HCkZipEntry CkZipEntry_NextEntry(HCkZipEntry cHandle);

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

Returns a null reference on failure

BOOL CkZipEntry_ReplaceData(HCkZipEntry cHandle, HCkByteData bdata);

Replaces the zip entry's existing contents with new data.

BOOL CkZipEntry_ReplaceStringAnsi(HCkZipEntry cHandle, HCkString sdata);

Replaces the zip entry's text content with a new ANSI string.

BOOL CkZipEntry_SaveLastError(HCkZipEntry cHandle, const char *filename);

Saves the last error information to an XML formatted file.

const char *CkZipEntry_comment(HCkZipEntry cHandle);

The comment stored within the Zip for this entry.

Returns a null on failure

const char *CkZipEntry_copyToBase64(HCkZipEntry cHandle);

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

const char *CkZipEntry_copyToHex(HCkZipEntry cHandle);

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

const char *CkZipEntry_fileName(HCkZipEntry cHandle);

The file name of the Zip entry.

Returns a null on failure

const char *CkZipEntry_inflateToString(HCkZipEntry cHandle, BOOL addCR);

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

const char *CkZipEntry_inflateToString2(HCkZipEntry cHandle);

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

Returns a null on failure

const char *CkZipEntry_lastErrorHtml(HCkZipEntry cHandle);

Error information in HTML format for the last method called.

Returns a null on failure

const char *CkZipEntry_lastErrorText(HCkZipEntry cHandle);

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

Returns a null on failure

const char *CkZipEntry_lastErrorXml(HCkZipEntry cHandle);

Error information in XML format for the last method called.

Returns a null on failure