⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 zlib.html

📁 Web VNC samples delphi
💻 HTML
📖 第 1 页 / 共 4 页
字号:
   of <a href="#deflateInit2">deflateInit2</a> for the meaning of these parameters.   <p>     <a href="#gzsetparams">gzsetparams</a> returns <a href="#Z_OK">Z_OK</a> if success, or <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if the file was not   opened for writing.   <p><font color="Blue"><dt> int     <a name="gzread">gzread</a>  (gzFile file, voidp buf, unsigned len);</font><dd>     Reads the given number of uncompressed bytes from the compressed file.   If the input file was not in gzip format, <a href="#gzread">gzread</a> copies the given number   of bytes into the buffer.   <p>     <a href="#gzread">gzread</a> returns the number of uncompressed bytes actually read (0 for   end of file, -1 for error).   <p><font color="Blue"><dt> int     <a name="gzwrite">gzwrite</a> (gzFile file, const voidp buf, unsigned len);</font><dd>     Writes the given number of uncompressed bytes into the compressed file.   <a href="#gzwrite">gzwrite</a> returns the number of uncompressed bytes actually written   (0 in case of error).   <p><font color="Blue"><dt> int VA   <a name="gzprintf">gzprintf</a> (gzFile file, const char *format, ...);</font><dd>     Converts, formats, and writes the args to the compressed file under   control of the format string, as in fprintf. <a href="#gzprintf">gzprintf</a> returns the number of   uncompressed bytes actually written (0 in case of error).   <p><font color="Blue"><dt> int  <a name="gzputs">gzputs</a> (gzFile file, const char *s);</font><dd>      Writes the given null-terminated string to the compressed file, excluding   the terminating null character.   <p>      <a href="#gzputs">gzputs</a> returns the number of characters written, or -1 in case of error.      <p><font color="Blue"><dt> char *  <a name="gzgets">gzgets</a> (gzFile file, char *buf, int len);</font><dd>      Reads bytes from the compressed file until len-1 characters are read, or   a newline character is read and transferred to buf, or an end-of-file   condition is encountered.  The string is then terminated with a null   character.   <p>      <a href="#gzgets">gzgets</a> returns buf, or <a href="#Z_NULL">Z_NULL</a> in case of error.      <p><font color="Blue"><dt> int     <a name="gzputc">gzputc</a> (gzFile file, int c);</font><dd>      Writes c, converted to an unsigned char, into the compressed file.   <a href="#gzputc">gzputc</a> returns the value that was written, or -1 in case of error.   <p><font color="Blue"><dt> int     <a name="gzgetc">gzgetc</a> (gzFile file);</font><dd>      Reads one byte from the compressed file. <a href="#gzgetc">gzgetc</a> returns this byte   or -1 in case of end of file or error.   <p><font color="Blue"><dt> int     <a name="gzflush">gzflush</a> (gzFile file, int flush);</font><dd>     Flushes all pending output into the compressed file. The parameter   flush is as in the <a href="#deflate">deflate</a>() function. The return value is the zlib   error number (see function <a href="#gzerror">gzerror</a> below). <a href="#gzflush">gzflush</a> returns <a href="#Z_OK">Z_OK</a> if   the flush parameter is <a href="#Z_FINISH">Z_FINISH</a> and all output could be flushed.   <p>     <a href="#gzflush">gzflush</a> should be called only when strictly necessary because it can   degrade compression.   <p><font color="Blue"><dt> z_off_t     <a name="gzseek">gzseek</a> (gzFile file, z_off_t offset, int whence);</font><dd>      Sets the starting position for the next <a href="#gzread">gzread</a> or <a href="#gzwrite">gzwrite</a> on the   given compressed file. The offset represents a number of bytes in the   uncompressed data stream. The whence parameter is defined as in lseek(2);   the value SEEK_END is not supported.   <p>     If the file is opened for reading, this function is emulated but can be   extremely slow. If the file is opened for writing, only forward seeks are   supported ; <a href="#gzseek">gzseek</a> then compresses a sequence of zeroes up to the new   starting position.   <p>      <a href="#gzseek">gzseek</a> returns the resulting offset location as measured in bytes from   the beginning of the uncompressed stream, or -1 in case of error, in   particular if the file is opened for writing and the new starting position   would be before the current position.   <p><font color="Blue"><dt> int     <a name="gzrewind">gzrewind</a> (gzFile file);</font><dd>     Rewinds the given file. This function is supported only for reading.     <p>   <a href="#gzrewind">gzrewind</a>(file) is equivalent to (int)<a href="#gzseek">gzseek</a>(file, 0L, SEEK_SET)   <p><font color="Blue"><dt> z_off_t     <a name="gztell">gztell</a> (gzFile file);</font><dd>     Returns the starting position for the next <a href="#gzread">gzread</a> or <a href="#gzwrite">gzwrite</a> on the   given compressed file. This position represents a number of bytes in the   uncompressed data stream.   <p>   <a href="#gztell">gztell</a>(file) is equivalent to <a href="#gzseek">gzseek</a>(file, 0L, SEEK_CUR)   <p><font color="Blue"><dt> int  <a name="gzeof">gzeof</a> (gzFile file);</font><dd>     Returns 1 when EOF has previously been detected reading the given   input stream, otherwise zero.   <p><font color="Blue"><dt> int     <a name="gzclose">gzclose</a> (gzFile file);</font><dd>     Flushes all pending output if necessary, closes the compressed file   and deallocates all the (de)compression <a href="#state">state</a>. The return value is the zlib   error number (see function <a href="#gzerror">gzerror</a> below).   <p><font color="Blue"><dt> const char *  <a name="gzerror">gzerror</a> (gzFile file, int *errnum);</font><dd>     Returns the error message for the last error which occurred on the   given compressed file. errnum is set to zlib error number. If an   error occurred in the file system and not in the compression library,   errnum is set to <a href="#Z_ERRNO">Z_ERRNO</a> and the application may consult errno   to get the exact error code.   <p></dl><hr><a name="Basic functions"><h2> Basic functions </h2><h3> Function list </h3><ul><li>  const char *  <a href="#zlibVersion">zlibVersion</a> (void);<li>  int  <a href="#deflateInit">deflateInit</a> (<a href="#z_streamp">z_streamp</a> strm, int level);<li>  int  <a href="#deflate">deflate</a> (<a href="#z_streamp">z_streamp</a> strm, int flush);<li>  int  <a href="#deflateEnd">deflateEnd</a> (<a href="#z_streamp">z_streamp</a> strm);<li>  int  <a href="#inflateInit">inflateInit</a> (<a href="#z_streamp">z_streamp</a> strm);<li>  int  <a href="#inflate">inflate</a> (<a href="#z_streamp">z_streamp</a> strm, int flush);<li>  int  <a href="#inflateEnd">inflateEnd</a> (<a href="#z_streamp">z_streamp</a> strm);</ul><h3> Function description </h3><dl><font color="Blue"><dt>  const char *  <a name="zlibVersion">zlibVersion</a> (void);</font><dd> The application can compare <a href="#zlibVersion">zlibVersion</a> and ZLIB_VERSION for consistency.   If the first character differs, the library code actually used is   not compatible with the zlib.h header file used by the application.   This check is automatically made by <a href="#deflateInit">deflateInit</a> and <a href="#inflateInit">inflateInit</a>.   <p><font color="Blue"><dt> int  <a name="deflateInit">deflateInit</a> (<a href="#z_streamp">z_streamp</a> strm, int level);</font><dd>     Initializes the internal stream <a href="#state">state</a> for compression. The fields   <a href="#zalloc">zalloc</a>, <a href="#zfree">zfree</a> and <a href="#opaque">opaque</a> must be initialized before by the caller.   If <a href="#zalloc">zalloc</a> and <a href="#zfree">zfree</a> are set to <a href="#Z_NULL">Z_NULL</a>, <a href="#deflateInit">deflateInit</a> updates them to   use default allocation functions.   <p>     The compression level must be <a href="#Z_DEFAULT_COMPRESSION">Z_DEFAULT_COMPRESSION</a>, or between 0 and 9:   1 gives best speed, 9 gives best compression, 0 gives no compression at   all (the input data is simply copied a block at a time).   <p>   <a href="#Z_DEFAULT_COMPRESSION">Z_DEFAULT_COMPRESSION</a> requests a default compromise between speed and   compression (currently equivalent to level 6).   <p>     <a href="#deflateInit">deflateInit</a> returns <a href="#Z_OK">Z_OK</a> if success, <a href="#Z_MEM_ERROR">Z_MEM_ERROR</a> if there was not   enough memory, <a href="#Z_STREAM_ERROR">Z_STREAM_ERROR</a> if level is not a valid compression level,   <a href="#Z_VERSION_ERROR">Z_VERSION_ERROR</a> if the zlib library version (<a href="#zlib_version">zlib_version</a>) is incompatible   with the version assumed by the caller (ZLIB_VERSION).   <a href="#msg">msg</a> is set to null if there is no error message.  <a href="#deflateInit">deflateInit</a> does not   perform any compression: this will be done by <a href="#deflate">deflate</a>().   <p><font color="Blue"><dt>  int  <a name="deflate">deflate</a> (<a href="#z_streamp">z_streamp</a> strm, int flush);</font><dd>    <a href="#deflate">deflate</a> compresses as much data as possible, and stops when the input  buffer becomes empty or the output buffer becomes full. It may introduce some  output latency (reading input without producing any output) except when  forced to flush.<p>    The detailed semantics are as follows. <a href="#deflate">deflate</a> performs one or both of the  following actions:  <ul>  <li> Compress more input starting at <a href="#next_in">next_in</a> and update <a href="#next_in">next_in</a> and <a href="#avail_in">avail_in</a>    accordingly. If not all input can be processed (because there is not    enough room in the output buffer), <a href="#next_in">next_in</a> and <a href="#avail_in">avail_in</a> are updated and    processing will resume at this point for the next call of <a href="#deflate">deflate</a>().  <li>     Provide more output starting at <a href="#next_out">next_out</a> and update <a href="#next_out">next_out</a> and <a href="#avail_out">avail_out</a>    accordingly. This action is forced if the parameter flush is non zero.    Forcing flush frequently degrades the compression ratio, so this parameter    should be set only when necessary (in interactive applications).    Some output may be provided even if flush is not set.  </ul> <p>  Before the call of <a href="#deflate">deflate</a>(), the application should ensure that at least  one of the actions is possible, by providing more input and/or consuming  more output, and updating <a href="#avail_in">avail_in</a> or <a href="#avail_out">avail_out</a> accordingly ; <a href="#avail_out">avail_out</a>  should never be zero before the call. The application can consume the  compressed output when it wants, for example when the output buffer is full  (<a href="#avail_out">avail_out</a> == 0), or after each call of <a href="#deflate">deflate</a>(). If <a href="#deflate">deflate</a> returns <a href="#Z_OK">Z_OK</a>  and with zero <a href="#avail_out">avail_out</a>, it must be called again after making room in the  output buffer because there might be more output pending.  <p>    If the parameter flush is set to <a href="#Z_SYNC_FLUSH">Z_SYNC_FLUSH</a>, all pending output is  flushed to the output buffer and the output is aligned on a byte boundary, so  that the decompressor can get all input data available so far. (In particular  <a href="#avail_in">avail_in</a> is zero after the call if enough output space has been provided  before the call.)  Flushing may degrade compression for some compression  algorithms and so it should be used only when necessary.  <p>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -