Gzip (String function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
Line 13: Line 13:


<tr><th><var>FixedCode</var></th>
<tr><th><var>FixedCode</var></th>
<td><var>Boolean</var> value ([[under construction]]).</td></tr>
<td><var>FixedCode</var> is an optional, [[Notation conventions for methods#Named parameters|name required]], parameter that is a <var>[[Boolean_enumeration#Using_Boolean_enumerations|Boolean]]</var> value that specifies whether the compression uses fixed codes or is dynamic, based on the contents of the input <var class="term">string</var>.
<ul>
<li>With fixed code compression (<code>fixedCode=true</code>), the tables used for compression (defined as part of RFC 1951) are somewhat optimized for ASCII character data, but they slightly decrease the amount of CPU required to perform compression. Also, since the codes are already defined as part of the specification, they are not included in the compressed data.
<li>With dynamic compression (<code>fixedCode=false</code>), the compression code tables are generated based on the input data. Dynamic tables typically provide somewhat better compression on most types of data. There is a very slight CPU overhead in computing the frequencies of byte values in the input data. Also, since the code tables are dynamic, they are included as part of the compressed data. This will increase the size of the compressed longstring, but these tables are small, since they are also stored in a compressed form.
</ul>
The default value for this argument is <var>False</var> (use dynamic compression).</td></tr>


<tr><th><var>LazyMatch</var></th>
<tr><th><var>LazyMatch</var></th>
<td><var>Boolean</var> value ([[under construction]])</td></tr>
<td><var>LazyMatch</var> is an optional, name required, parameter that is a <var>Boolean</var> value that specifies whether to use "lazy match" compression, as specified in RFC 1951.
The default value for this argument is <var>False</var> (do not use "lazy match" compression).</td></tr>


<tr><th><var>MaxChain</var></th>
<tr><th><var>MaxChain</var></th>
<td>number ([[under construction]])</td></tr>
<td><var>MaxChain</var> is an optional, name required, parameter that is a numeric value that specifies the maximum hash chain length, as explained in RFC 1951.
The default value for this argument is 0. If specified, it must be between 0 and 99, inclusive.</td></tr>


<tr><th><var>Filename</var></th>
<tr><th><var>Filename</var></th>
<td>string ([[under construction]])</td></tr>
<td><var>Filename</var> is an optional, name required, parameter that is a string ([[under construction]])</td></tr>


<tr><th><var>LastModified</var></th>
<tr><th><var>LastModified</var></th>

Revision as of 18:40, 9 August 2012

Compress a longstring with GZIP (String class)

[Introduced in Sirius Mods 7.4]


Syntax

%outString = string:Gzip[( [FixedCode= boolean], [LazyMatch= boolean], - [MaxChain= number], [Filename= string], - [LastModified= number])]

Syntax terms

%outString The result of the GZIP operation, compressing the method object string.
string The string to be compressed by the GZIP operation.
FixedCode FixedCode is an optional, name required, parameter that is a Boolean value that specifies whether the compression uses fixed codes or is dynamic, based on the contents of the input string.
  • With fixed code compression (fixedCode=true), the tables used for compression (defined as part of RFC 1951) are somewhat optimized for ASCII character data, but they slightly decrease the amount of CPU required to perform compression. Also, since the codes are already defined as part of the specification, they are not included in the compressed data.
  • With dynamic compression (fixedCode=false), the compression code tables are generated based on the input data. Dynamic tables typically provide somewhat better compression on most types of data. There is a very slight CPU overhead in computing the frequencies of byte values in the input data. Also, since the code tables are dynamic, they are included as part of the compressed data. This will increase the size of the compressed longstring, but these tables are small, since they are also stored in a compressed form.
The default value for this argument is False (use dynamic compression).
LazyMatch LazyMatch is an optional, name required, parameter that is a Boolean value that specifies whether to use "lazy match" compression, as specified in RFC 1951. The default value for this argument is False (do not use "lazy match" compression).
MaxChain MaxChain is an optional, name required, parameter that is a numeric value that specifies the maximum hash chain length, as explained in RFC 1951. The default value for this argument is 0. If specified, it must be between 0 and 99, inclusive.
Filename Filename is an optional, name required, parameter that is a string (under construction)
LastModified The date/time stamp to be stored as a component of %outString, expressed as the number of milliseconds since 12:00 AM, Jan 1, 1900. The default is the current date and time (that is, %(System):CurrentTimeMilliseconds).

After Gzip stores a value into %outString, the LastModified date/time stamp can be obtained with the GunzipDatetimeNS function, but note that its output is in seconds, not milliseconds.

Usage notes

See also