Chilkat.Gzip PHP Reference

Chilkat.Gzip

GZip compression component.

Object Creation

$obj = new COM("Chilkat.Gzip");

Properties

string Comment

Specifies an optional comment string that can be embedded within the .gz when any Compress* method is called.

VARIANT ExtraData

Optional extra-data that can be included within a .gz when a Compress* method is called.

string Filename

The filename that is embedded within the .gz during any Compress* method call. When extracting from a .gz using applications such as WinZip, this will be the filename that is created.

string LastErrorHtml (read-only)

Error information in HTML format for the last method called.

string LastErrorText (read-only)

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

string LastErrorXml (read-only)

Error information in XML format for the last method called.

Date LastMod

The last-modification date/time to be embedded within the .gz when a Compress* method is called. By default, the current system date/time is used.

bool UseCurrentDate

To be documented soon...

string Version (read-only)

Version of the component, such as "1.0.0"

Methods

bool CompressFile(string inFilename, string outGzipFilename)

Compresses a file to create a GZip compressed file (.gz).

Returns 1 for success, 0 for failure.

bool CompressFile2(string inFilename, string embeddedFilename, string outGzipFilename)

Compresses a file to create a GZip compressed file (.gz). inFilename is the actual filename on disk. embeddedFilename is the filename to be embedded in the .gz such that when it is un-gzipped, this is the name of the file that will be created.

Returns 1 for success, 0 for failure.

VARIANT CompressFileToMem(string inFilename)

Gzip compresses a file to an in-memory image of a .gz file.

Returns 1 for success, 0 for failure.

bool CompressMemToFile(VARIANT inData, string outFilename)

Gzip compresses and creates a .gz file from in-memory data.

Returns 1 for success, 0 for failure.

VARIANT CompressMemory(VARIANT inData)

Compresses in-memory data to an in-memory image of a .gz file.

Returns 1 for success, 0 for failure.

VARIANT CompressString(string inString, string outCharset)

Gzip compresses a string and writes the output to a byte array. The string is first converted to the charset specified by outCharset. Typical charsets are "utf-8", "iso-8859-1", "shift_JIS", etc.

Returns 1 for success, 0 for failure.

Full List of Charset Names

bool CompressStringToFile(string inStr, string outCharset, string outFilename)

Gzip compresses a string and writes the output to a .gz compressed file. The string is first converted to the charset specified by ARG2. Typical charsets are "utf-8", "iso-8859-1", "shift_JIS", etc.

Returns 1 for success, 0 for failure.

Full List of Charset Names

VARIANT Decode(string str, string encoding)

To be documented soon...

string DeflateStringENC(string inString, string charsetName, string outputEncoding)

Provides the ability to use the zip/gzip's deflate algorithm directly to compress a string. Internal to this method, inString is first converted to the charset specified by charsetName. The data is then compressed using the deflate compression algorithm. The binary output is then encoded according to outputEncoding. Possible values for outputEncoding are "hex", "base64", "url", and "quoted-printable".

Returns a null on failure

Full List of Charset Names

string Encode(VARIANT byteData, string encoding)

To be documented soon...

bool ExamineFile(string inGzFilename)

To be documented soon...

bool ExamineMemory(VARIANT inGzData)

To be documented soon...

string InflateStringENC(string inString, string convertFromCharset, string inputEncoding)

This the reverse of DeflateStringENC.

The input string is first decoded according to inputEncoding. (Possible values for inputEncoding are "hex", "base64", "url", and "quoted-printable".) The compressed data is then inflated, and the result is then converted from convertFromCharset (if necessary) to return a string.

Returns a null on failure

bool IsUnlocked()

Returns true if the component has been unlocked.

VARIANT ReadFile(string filename)

Reads a binary file into memory and returns the byte array. Note: This method does not parse a Gzip, it is only a convenience method for reading a binary file into memory.

Returns 1 for success, 0 for failure.

void SaveLastError(string filename)

Saves the last error information to an XML formatted file.

bool UnTarGz(string gzFilename, string destDir, int noAbsolute)

Unpacks a .tar.gz file. The ungzip and untar occur in streaming mode. There are no temporary files and the memory footprint is constant (and small) while untarring.

Returns 1 for success, 0 for failure.

bool UncompressFile(string inFilename, string outFilename)

Un-Gzips a .gz file. The output filename is specified by the 2nd argument and not by the filename embedded within the .gz.

Returns 1 for success, 0 for failure.

VARIANT UncompressFileToMem(string inFilename)

Un-Gzips a .gz file directly to memory.

Returns 1 for success, 0 for failure.

string UncompressFileToString(string gzFilename, string charset)

Uncompresses a .gz file that contains a text file. The contents of the text file are returned as a string. The character encoding of the text file is specified by charset. Typical charsets are "iso-8859-1", "utf-8", "windows-1252", "shift_JIS", "big5", etc.

Returns a null on failure

List of Valid Charsets

bool UncompressMemToFile(VARIANT inData, string outFilename)

Un-Gzips from an in-memory image of a .gz file to a file.

Returns 1 for success, 0 for failure.

VARIANT UncompressMemory(VARIANT inData)

Un-Gzips from an in-memory image of a .gz file directly into memory.

Returns 1 for success, 0 for failure.

string UncompressString(VARIANT inData, string inCharset)

The reverse of CompressString.

The bytes in inData are uncompressed, then converted from inCharset (if necessary) to return a string.

Returns a null on failure

Full List of Charset Names

bool UnlockComponent(string b1)

Unlocks the component allowing for the full functionality to be used.

Returns 1 for success, 0 for failure.

bool WriteFile(string filename, VARIANT binaryData)

A convenience method for writing a binary byte array to a file.

Returns 1 for success, 0 for failure.

string XfdlToXml(string xfldData)

Converts base64-gzip .xfdl data to a decompressed XML string. The xfldData contains the base64 data. This method returns the decoded/decompressed XML string.

Returns a null on failure