Compress function (additional information)

Jerry Daniels jerry.daniels at me.com
Mon May 17 19:38:55 CDT 2010


I started to weep when I read this. It's beautiful!

Best,

Jerry Daniels

Create iPad web apps with Rodeo:
http://rodeoapps.com

On May 17, 2010, at 7:09 PM, Alejandro Tejada <capellan2000 at gmail.com> wrote:

> Hi all,
> 
> Who could help me and post this information about
> Compress() function in Online Dictionary:
> http://docs.runrev.com/Function/compress
> 
> You corrections and additions are welcome!
> :-)
> 
> Thanks in advance!
> 
> Alejandro
> 
> ------------------------------------------------------------------------------------------------
> The compress function returns a gzip compressed
> string of binary data structured in the following format:
> 
> 1) A 10-byte header, containing:
> 
> A magic number, composed by two bytes:
> 1F 8B (Hexadecimal) or 31 139 (ASCII Numbers
> of both characters)
> 
> A version number (always 08), that specify compression
> compression method used in the file.
> In this case Rev write the byte 08.
> This single character correspond to DEFLATE compression.
> 
> Additional information like timestamp, optional extra headers,
> (as the original file name) are not included and in their place
> Rev writes six null bytes: 00 00 00 00 00 00
> 
> Last char of 10 byte header correspond to the type of
> file system on which compression took place.
> Rev writes the single byte 03, that correspond to
> Unix.
> 
> For example: First Ten characters of a gzipped binary string
> (Hexadecimal)
> 1F 8B 08 00 00 00 00 00 00 03
> (ASCII Characters numbers)
> 31 139 08 00 00 00 00 00 00 03
> 
> 2- a body, containing DEFLATE-compressed data
> 
> 3- Last 8 characters contains a CRC-32 checksum and
> length of the original uncompressed data:
> For example: Last 8 characters of gzipped binary string
> (Hexadecimal)
> 8C 72 E5 F5 1A 34 02 00
> Last four bytes: 1A 34 02 00 = 0002341A = 144,410
> represent the file length (142 k)
> Bytes 8C 72 E5 F5 correspond to CRC-32 of
> this file: F5E5728C
> 
> If you need to use only the binary string of DEFLATE-compressed
> data, without the gzip header and footer, use a script like this:
> 
> put compress(myData) into myGzippedData
> put char 11 to -9 of myGzippedData into myDeflateData
> 
> or the short version:
> put char 11 to -9 of compress(myData) into myDeflateData
> 
> This binary string of DEFLATE-compressed data is useful
> if you need to write a Flate Encoded stream in a PDF file
> like this:
> 
> put "xÚ" & char 11 to -9 of myGzippedData into myFlateEncodedStream
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution



More information about the use-livecode mailing list