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 handle, HCkString retval);
void CkZipEntry_putComment(HCkZipEntry handle, const char *newVal);

The comment stored within the Zip for this entry.

unsigned long CkZipEntry_getCompressedLength(HCkZipEntry handle);

The size of this file when Zip compression is applied

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

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

long CkZipEntry_getCompressionMethod(HCkZipEntry handle);
void CkZipEntry_putCompressionMethod(HCkZipEntry handle, 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

long CkZipEntry_getEntryID(HCkZipEntry handle);

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

long CkZipEntry_getEntryType(HCkZipEntry handle);

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.

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

The last-modified time of the Zip entry.

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

The file name of the Zip entry.

BOOL CkZipEntry_getIsDirectory(HCkZipEntry handle);

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

void CkZipEntry_getLastErrorHtml(HCkZipEntry handle, HCkString retval);

Error information in HTML format for the last method called.

void CkZipEntry_getLastErrorText(HCkZipEntry handle, HCkString retval);

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

void CkZipEntry_getLastErrorXml(HCkZipEntry handle, HCkString retval);

Error information in XML format for the last method called.

unsigned long CkZipEntry_getUncompressedLength(HCkZipEntry handle);

The size in bytes of the Zip entry when uncompressed.

BOOL CkZipEntry_getUtf8(HCkZipEntry handle);
void CkZipEntry_putUtf8(HCkZipEntry handle, 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 handle, HCkByteData bdata);

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

BOOL CkZipEntry_AppendData(HCkZipEntry handle, HCkString sdata);

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

BOOL CkZipEntry_Copy(HCkZipEntry handle, HCkByteData bdata);

Returns the compressed data as a byte array.

BOOL CkZipEntry_CopyToBase64(HCkZipEntry handle, HCkString str);

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 handle, HCkString str);

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 handle, 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 handle, const char *dirPath);

Unzip a file into a specific directory

BOOL CkZipEntry_Inflate(HCkZipEntry handle, HCkByteData bdata);

Inflate a file within a Zip directly into memory.

BOOL CkZipEntry_InflateToString(HCkZipEntry handle, BOOL addCR, HCkString str);

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 handle, HCkString str);

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

HCkZipEntry CkZipEntry_NextEntry(HCkZipEntry handle);

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

Returns a null reference on failure

BOOL CkZipEntry_ReplaceData(HCkZipEntry handle, HCkByteData bdata);

Replace the contents of a file within a Zip archive

BOOL CkZipEntry_ReplaceData(HCkZipEntry handle, HCkString sdata);

Replace the contents of a file within a Zip archive

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

Saves the last error information to an XML formatted file.

const char *CkZipEntry_comment(HCkZipEntry handle);

The comment stored within the Zip for this entry.

const char *CkZipEntry_copyToBase64(HCkZipEntry handle);

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

const char *CkZipEntry_copyToHex(HCkZipEntry handle);

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

const char *CkZipEntry_fileName(HCkZipEntry handle);

The file name of the Zip entry.

const char *CkZipEntry_inflateToString(HCkZipEntry handle, 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.

const char *CkZipEntry_inflateToString2(HCkZipEntry handle);

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

const char *CkZipEntry_lastErrorHtml(HCkZipEntry handle);

Error information in HTML format for the last method called.

const char *CkZipEntry_lastErrorText(HCkZipEntry handle);

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

const char *CkZipEntry_lastErrorXml(HCkZipEntry handle);

Error information in XML format for the last method called.