Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > by-pkgid > ebb1914cf182a88528b4547490db1dd8 > files > 1685

kdewebdev-quanta-doc-3.5.9-2mdv2008.1.x86_64.rpm

<HTML
><HEAD
><TITLE
>Compression functions</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.44"><LINK
REL="HOME"
TITLE="PHP Manual"
HREF="manual.html"><LINK
REL="UP"
TITLE="Function Reference"
HREF="funcref.html"><LINK
REL="PREVIOUS"
TITLE="cpdf_add_annotation"
HREF="function.cpdf-add-annotation.html"><LINK
REL="NEXT"
TITLE="gzclose"
HREF="function.gzclose.html"></HEAD
><BODY
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP Manual</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.cpdf-add-annotation.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.gzclose.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="reference"
><A
NAME="ref.zlib"
></A
><DIV
CLASS="TITLEPAGE"
><H1
CLASS="title"
>VII. Compression functions</H1
><DIV
CLASS="PARTINTRO"
><A
NAME="AEN6246"
></A
><P
>&#13;   This module uses the functions of <A
HREF="http://www.cdrom.com/pub/infozip/zlib/"
TARGET="_top"
>zlib</A
> by Jean-loup Gailly and Mark Adler to
   transparently read and write gzip (.gz) compressed files. You have
   to use a zlib version &#62;= 1.0.9 with this module.
  </P
><P
>&#13;   This module contains versions of most of the <A
HREF="ref.filesystem.html"
>filesystem</A
> functions which work
   with gzip-compressed files (and uncompressed files, too, but not
   with sockets).
  </P
><DIV
CLASS="sect1"
><H1
CLASS="sect1"
><A
NAME="zlib-example"
>Small code example</A
></H1
><P
>&#13;      Opens a temporary file and writes a test string to it, then it
      prints out the content of this file twice.
     </P
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><P
><B
>Example 1. Small Zlib example</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><PRE
CLASS="programlisting"
>  1&nbsp;
  2&nbsp;&#60;?php
  3&nbsp;  $filename = tempnam('/tmp', 'zlibtest').'.gz';
  4&nbsp;  print "&#60;html&#62;\n&#60;head&#62;&#60;/head&#62;\n&#60;body&#62;\n&#60;pre&#62;\n";
  5&nbsp;  $s = "Only a test, test, test, test, test, test, test, test!\n";
  6&nbsp;  // open file for writing with maximum compression
  7&nbsp;  $zp = gzopen($filename, "w9");
  8&nbsp;  // write string to file
  9&nbsp;  gzwrite($zp, $s);
 10&nbsp;  // close file
 11&nbsp;  gzclose($zp);
 12&nbsp;  // open file for reading
 13&nbsp;  $zp = gzopen($filename, "r");
 14&nbsp;  // read 3 char
 15&nbsp;  print gzread($zp, 3);
 16&nbsp;  // output until end of the file and close it.
 17&nbsp;  gzpassthru($zp);
 18&nbsp;  print "\n";
 19&nbsp;  // open file and print content (the 2nd time).
 20&nbsp;  if (readgzfile($filename) != strlen($s)) {
 21&nbsp;          echo "Error with zlib functions!";
 22&nbsp;  }
 23&nbsp;  unlink($filename);
 24&nbsp;  print "&#60;pre&#62;\n&#60;/h1&#62;&#60;/body&#62;\n&#60;/html&#62;\n";
 25&nbsp;?&#62;
 26&nbsp;</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
></DIV
></DIV
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="function.gzclose.html"
>gzclose</A
> &#8212; close an open gz-file pointer</DT
><DT
><A
HREF="function.gzeof.html"
>gzeof</A
> &#8212; test for end-of-file on a gz-file pointer</DT
><DT
><A
HREF="function.gzfile.html"
>gzfile</A
> &#8212; read entire gz-file into an
    array</DT
><DT
><A
HREF="function.gzgetc.html"
>gzgetc</A
> &#8212; get character from gz-file pointer</DT
><DT
><A
HREF="function.gzgets.html"
>gzgets</A
> &#8212; get line from file pointer</DT
><DT
><A
HREF="function.gzgetss.html"
>gzgetss</A
> &#8212; get line from gz-file pointer and strip HTML tags</DT
><DT
><A
HREF="function.gzopen.html"
>gzopen</A
> &#8212; open gz-file</DT
><DT
><A
HREF="function.gzpassthru.html"
>gzpassthru</A
> &#8212; output all remaining data on a gz-file pointer</DT
><DT
><A
HREF="function.gzputs.html"
>gzputs</A
> &#8212; write to a gz-file pointer</DT
><DT
><A
HREF="function.gzread.html"
>gzread</A
> &#8212; Binary-safe gz-file read</DT
><DT
><A
HREF="function.gzrewind.html"
>gzrewind</A
> &#8212; rewind the position of a gz-file pointer</DT
><DT
><A
HREF="function.gzseek.html"
>gzseek</A
> &#8212; seek on a gz-file pointer</DT
><DT
><A
HREF="function.gztell.html"
>gztell</A
> &#8212; tell gz-file pointer read/write position</DT
><DT
><A
HREF="function.gzwrite.html"
>gzwrite</A
> &#8212; Binary-safe gz-file write</DT
><DT
><A
HREF="function.readgzfile.html"
>readgzfile</A
> &#8212; output a gz-file</DT
></DL
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.cpdf-add-annotation.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="manual.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.gzclose.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>cpdf_add_annotation</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="funcref.html"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>gzclose</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>