Get libzio at SourceForge.net. Fast, secure and Free Open Source software downloads

Libzio - file stream access for gzip/bzip2 files

The libzio provides with the help the fopencookie(3) extension of the glibc or funopen(3) function known on BSD Systems together with zlib and libbzip2 an interface to read or write gzip/bzip2 files with streams. Beside handling gzip, bzip2 and lzma files, the libzio provides support for reading ``.Z'' compressed files. Libzio uses the GNUC weak facility to allow programs to be linked against zlib, libbzip2 or liblzmadec only.

Details

The program using libzio with -lzio at linkage time should also be linked with the appropriate library for accessing compressed text files. This is the libz with -lz for accessing gziped text files and/or with -lbz2 for accessing bzip2ed text files.

For writing gzip or bzip2 files, fzopen only supports the suffixes .z and .gz for gzipped files and .bz2 for bzip2ed files. All supported formats can be found in the following table:

freadfwritefseeksuffixlibrary
gzipyes yes yes .gz -lz
bzip2yes yes yes .bz2 -lbz2
LZWyes no yes .Z builtin
lzmayes yes(no)yes.lzma -llzma (-llzmadec)
xzyes yes yes .xz -llzma
zstdyes yes no .zst -lzstd

On reading first the appropriate suffixes are checked if not provided. If no file is found the magic byte sequence at the beginning of the file is checked to detect a gzip or bzip2 file.

Links

Libzio - file stream access for gzip/bzip2 files: Download

The zlib home page at https://www.zlib.net

The bzip2 home page at https://www.bzip.org

The gzip home page at https://www.gzip.org

The LZMA home page at https://tukaani.org/lzma

The XZ home page at https://tukaani.org/xz

The zstd home page at https://github.com/facebook/zstd