compressed_ports is a Bigloo library supporting compressed input and output ports. It currentlys supports gzip, bzip2, xz, lz4, and zstd. Both the Bigloo native and jvm backends are supported. It requires a recent version of Bigloo.
To build, execute:
./configure --prefix=<installation path prefix>; make
where <installation path prefix>
is the desired installation path
prefix (e.g, /usr/local
). You usually want the path prefix to match
that used by Bigloo itself.
To build native support, you need the bzip2, zstd, xz, lz4, and zlib libraries and development files installed.
To build jvm support, you need Maven installed to pull the bzip2, zstd, xz and lz4 jars. Luckily, Gzip support is a part of the Java standard library.
To Install, execute:
make install
The unit tests depend on btest. It needs to be installed before running tests. To run the tests, execute:
make test
The api mirrors what is provided for gzip and deflate in Bigloo’s standard library with the notable addition of supporting both input from and output to compressed ports. The supported compression algorithms are gzip, deflate, zlib, bzip2, xz, lz4, and zstd.
For each supported compression type, there are procedures for opening an input or output file/port. Predicates for evaluating whether a given file is compressed with a specific compression method are also available.
open-input-gzip-file filename [buffer #t]
open-input-gzip-port input-port [buffer #t]
Open a gzipped file or input-port
. Note that closing
a gzip-port
opened from a port input-port
does not close the input-port
port.
open-output-gzip-file filename [bufinfo #t]
open-output-gzip-port port [bufinfo #t]
Open a gzipped file or output-port
. Note that closing a gzip-port
opened from a port output-port
does not close the output-port
port.
file-gzip? file-name
Return whether or not the given file is gzipped or not.
open-input-inflate-file filename [buffer #t]
open-input-inflate-port input-port [buffer #t]
Open a deflated file or input-port
. Note that closing
a inflate-port
opened from a port input-port
does not close the input-port
port.
open-output-deflate-file filename [bufinfo #t]
open-output-deflate-port port [bufinfo #t]
Open a deflated file or output-port
. Note that closing a deflate-port
opened from a port output-port
does not close the output-port
port.
file-deflate? file-name
Return whether or not the given file is dflateded or not.
open-input-zlib-file filename [buffer #t]
open-input-zlib-port input-port [buffer #t]
Open a zlibbed file or input-port
. Note that closing
a zlib-port
opened from a port input-port
does not close the input-port
port.
open-output-zlib-file filename [bufinfo #t]
open-output-zlib-port port [bufinfo #t]
Open a zlibbed file or output-port
. Note that closing a zlib-port
opened from a port output-port
does not close the output-port
port.
file-zlib? file-name
Return whether or not the given file is zlibbed or not.
open-input-bzip2-file filename [buffer #t]
open-input-bzip2-port input-port [buffer #t]
Open a bzipped file or input-port
. Note that closing
a bzip2-port
opened from a port input-port
does not close the input-port
port.
open-output-bzip2-file filename [bufinfo #t]
open-output-bzip2-port port [bufinfo #t]
Open a bzipped file or output-port
. Note that closing a bzip2-port
opened from a port output-port
does not close the output-port
port.
file-bzip2? file-name
Return whether or not the given file is bzipped or not.
open-input-xz-file filename [buffer #t]
open-input-xz-port input-port [buffer #t]
Open a xzed file or input-port
. Note that closing
a xz-port
opened from a port input-port
does not close the input-port
port.
open-output-xz-file filename [bufinfo #t]
open-output-xz-port port [bufinfo #t]
Open a xzed file or output-port
. Note that closing a xz-port
opened from a port output-port
does not close the output-port
port.
file-xz? file-name
Return whether or not the given file is xzed or not.
open-input-lz4-file filename [buffer #t]
open-input-lz4-port input-port [buffer #t]
Open a lz4ed file or input-port
. Note that closing
a xz-port
opened from a port input-port
does not close the input-port
port.
open-output-lz4-file filename [bufinfo #t]
open-output-lz4-port port [bufinfo #t]
Open a lz4ed file or output-port
. Note that closing a lz4-port
opened from a port output-port
does not close the output-port
port.
file-lz4? file-name
Return whether or not the given file is lz4ed or not.
open-input-zstd-file filename [buffer #t]
open-input-zstd-port input-port [buffer #t]
Open a zstded file or input-port
. Note that closing
a zstd-port
opened from a port input-port
does not close the input-port
port.
open-output-zstd-file filename [bufinfo #t]
open-output-xztd-port port [bufinfo #t]
Open a zstded file or output-port
. Note that closing a zstd-port
opened from a port output-port
does not close the output-port
port.
file-zstd? file-name
Return whether or not the given file is zstded or not.