ENH: Support more compression formats
This MR adds support for the bzip2 and zstd compression formats. As part of this work, the code has been converted from C to C++, and substantially refactored - adding new compression formats in the future will be very straightforward.
The API has been changed, but there are very few direct users of the znzlib library, so updating the rest of the code base won't require too much work, and a full rebuild of all projects won't be needed.
- All symbols are now located in a
znzC++ namespace. -
znzFileis now a C++ class rather than a pointer to a struct. -
znz*functions are called on aznzFileinstance, rather than being standalone functions into which aznzFilepointer is passed:-
znzopen->znzFile/znzFile.open -
znzread->znzFile.read -
znzwrite->znzFile.write -
znzseek->znzFile.seek -
znzrewind->znzFile.rewind -
znzeof->znzFile.eof -
znztell-> Removed (no use in codebase) -
znzputs-> Removed (no use in codebase) -
znzgets-> Removed (no use in codebase) -
znzprintf-> Removed (no use in codebase) -
znzclose()->znzFile.close()(file is closed automatically upon destruction)
-
- When creating a
znzFile, rather than a booleanuse_compressionflag, aznzFormatvalue may be passed, specifying the compression format. - When creating a
znzFilefor reading, the default behaviour is to guess the compression format from the file contents. - When creating a
znzFilefor writing, the default behaviour is to guess the compression format from the file suffix.
Edited by Paul McCarthy