Unit gzIO

Classes

Functions

gzclose - GZCLOSE =================================================================== Flushes all pending output if necessary, closes the compressed file and deallocates all the (de)compression state.
gzerror - GZERROR =================================================================== Returns the error message for the last error which occured on the given compressed file.
gzflush - GZFLUSH =================================================================== Flushes all pending output into the compressed file.
gzgetc - GZGETC ==================================================================== Reads one byte from the compressed file.
gzgets - GZGETS ==================================================================== 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.
gzopen - GZOPEN ==================================================================== Opens a gzip (.
gzputc - =========================================================================== Converts, formats, and writes the args to the compressed file under control of the format string, as in fprintf.
gzputs - GZPUTS ==================================================================== Writes the given null-terminated string to the compressed file, excluding the terminating null character.
gzread - GZREAD ==================================================================== Reads the given number of uncompressed bytes from the compressed file.
gzseek - GZSEEK ==================================================================== Sets the starting position for the next gzread or gzwrite on the given compressed file.
gztell - GZTELL ==================================================================== Returns the starting position for the next gzread or gzwrite on the given compressed file.
gzwrite - GZWRITE =================================================================== Writes the given number of uncompressed bytes into the compressed file.

Types

gzFile
z_off_t

Constants

SEEK_CUR
SEEK_END
SEEK_SET

Variables


Functions


function gzclose (f:gzFile) : int;

GZCLOSE =================================================================== Flushes all pending output if necessary, closes the compressed file and deallocates all the (de)compression state. The return value is the zlib error number (see function gzerror below). ============================================================================

function gzerror (f:gzFile; var errnum:Int) : string;

GZERROR =================================================================== Returns the error message for the last error which occured on the given compressed file. errnum is set to zlib error number. If an error occured in the file system and not in the compression library, errnum is set to Z_ERRNO and the application may consult errno to get the exact error code. ============================================================================

function gzflush (f:gzFile; flush:int) : int;

GZFLUSH =================================================================== Flushes all pending output into the compressed file. The parameter flush is as in the zdeflate() function. The return value is the zlib error number (see function gzerror below). gzflush returns Z_OK if the flush parameter is Z_FINISH and all output could be flushed. gzflush should be called only when strictly necessary because it can degrade compression. ============================================================================

function gzgetc (f:gzfile) : int;

GZGETC ==================================================================== Reads one byte from the compressed file. gzgetc returns this byte or -1 in case of end of file or error. ============================================================================

function gzgets (f:gzfile; buf:PChar; len:int) : PChar;

GZGETS ==================================================================== 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 Null-terminated. gzgets returns buf, or Z_NULL in case of error. The current implementation is not optimized at all. ============================================================================

function gzopen (path:string; mode:string) : gzFile;

GZOPEN ==================================================================== Opens a gzip (.gz) file for reading or writing. As Pascal does not use file descriptors, the code has been changed to accept only path names. The mode parameter defaults to BINARY read or write operations ('r' or 'w') but can also include a compression level ('w9') or a strategy: Z_FILTERED as in 'w6f' or Z_HUFFMAN_ONLY as in 'w1h'. (See the description of deflateInit2 for more information about the strategy parameter.) gzopen can be used to open a file which is not in gzip format; in this case, gzread will directly read from the file without decompression. gzopen returns NIL if the file could not be opened (non-zero IOResult) or if there was insufficient memory to allocate the (de)compression state (zlib error is Z_MEM_ERROR). ============================================================================

function gzputc (f:gzfile; c:char) : int;

=========================================================================== Converts, formats, and writes the args to the compressed file under control of the format string, as in fprintf. gzprintf returns the number of uncompressed bytes actually written (0 in case of error). { GZPUTC ==================================================================== Writes c, converted to an unsigned char, into the compressed file. gzputc returns the value that was written, or -1 in case of error. ============================================================================

function gzputs (f:gzfile; s:PChar) : int;

GZPUTS ==================================================================== Writes the given null-terminated string to the compressed file, excluding the terminating null character. gzputs returns the number of characters written, or -1 in case of error. ============================================================================

function gzread (f:gzFile; buf:voidp; len:uInt) : int;

GZREAD ==================================================================== Reads the given number of uncompressed bytes from the compressed file. If the input file was not in gzip format, gzread copies the given number of bytes into the buffer. gzread returns the number of uncompressed bytes actually read (0 for end of file, -1 for error). ============================================================================

function gzseek (f:gzfile; offset:z_off_t; whence:int) : z_off_t;

GZSEEK ==================================================================== Sets the starting position for the next gzread or gzwrite on the given compressed file. The offset represents a number of bytes from the beginning of the uncompressed stream. gzseek returns the resulting offset, or -1 in case of error. SEEK_END is not implemented, returns error. In this version of the library, gzseek can be extremely slow. ============================================================================

function gztell (f:gzfile) : z_off_t;

GZTELL ==================================================================== Returns the starting position for the next gzread or gzwrite on the given compressed file. This position represents a number of bytes in the uncompressed data stream. ============================================================================

function gzwrite (f:gzFile; buf:voidp; len:uInt) : int;

GZWRITE =================================================================== Writes the given number of uncompressed bytes into the compressed file. gzwrite returns the number of uncompressed bytes actually written (0 in case of error). ============================================================================

Types


gzFile = voidp
Pascal unit based on gzio.c -- IO on .gz files Copyright (C) 1995-1998 Jean-loup Gailly. Define NO_DEFLATE to compile this file without the compression code Pascal tranlastion based on code contributed by Francisco Javier Crespo Copyright (C) 1998 by Jacques Nomssi Nzali For conditions of distribution and use, see copyright notice in readme.txt
z_off_t = long

Constants

SEEK_CUR = 1

seek from beginning of file

SEEK_END = 2

seek from current position

SEEK_SET = 0


Variables