Disk ARchive
2.7.15
Full featured and portable backup and archiving tool
|
compression class for gzip and bzip2 algorithms More...
#include <compressor.hpp>
Inherits libdar::proto_compressor.
Public Member Functions | |
compressor (compression x_algo, generic_file &compressed_side, U_I compression_level=9) | |
compressor (const compressor &ref)=delete | |
compressor (compressor &&ref) noexcept=delete | |
compressor & | operator= (const compressor &ref)=delete |
compressor & | operator= (compressor &&ref) noexcept=delete |
virtual compression | get_algo () const override |
virtual void | suspend_compression () override |
virtual void | resume_compression () override |
virtual bool | is_compression_suspended () const override |
virtual bool | skippable (skippability direction, const infinint &amount) override |
whether the implementation is able to skip More... | |
virtual bool | skip (const infinint &pos) override |
skip at the absolute position More... | |
virtual bool | skip_to_eof () override |
skip to the end of file | |
virtual bool | skip_relative (S_I x) override |
skip relatively to the current position | |
virtual bool | truncatable (const infinint &pos) const override |
whether the implementation is able to truncate to the given position | |
virtual infinint | get_position () const override |
get the current read/write position | |
Protected Member Functions | |
virtual void | inherited_read_ahead (const infinint &amount) override |
tells the object that several calls to read() will follow to probably obtain at least the given amount of data More... | |
virtual U_I | inherited_read (char *a, U_I size) override |
implementation of read() operation More... | |
virtual void | inherited_write (const char *a, U_I size) override |
implementation of the write() operation More... | |
virtual void | inherited_truncate (const infinint &pos) override |
truncate file at the give offset More... | |
virtual void | inherited_sync_write () override |
write down any pending data More... | |
virtual void | inherited_flush_read () override |
reset internal engine, flush caches in order to read the data at current position More... | |
virtual void | inherited_terminate () override |
destructor-like call, except that it is allowed to throw exceptions More... | |
Private Member Functions | |
void | flush_write () |
drop all pending write and reset compression engine | |
Private Attributes | |
xfer * | compr |
datastructure for bzip2, gzip and zx compression (not use with compression::none | |
bool | read_mode |
read-only mode or write-only mode, read-write is write-only mode | |
generic_file * | compressed |
where to read from/write to compressed data | |
compression | algo |
compression algorithm used | |
bool | suspended |
whether compression is temporary suspended | |
compression class for gzip and bzip2 algorithms
Definition at line 44 of file compressor.hpp.
libdar::compressor::compressor | ( | compression | x_algo, |
generic_file & | compressed_side, | ||
U_I | compression_level = 9 |
||
) |
x_algo | only gzip, bzip2, xz and none are supported by this class |
compressed_side | where to read from/write to compressed data |
compression_level | compression level 1..9 |
|
delete |
|
overrideprotectedvirtual |
reset internal engine, flush caches in order to read the data at current position
Implements libdar::generic_file.
Referenced by skip(), skip_relative(), and skip_to_eof().
|
overrideprotectedvirtual |
implementation of read() operation
[in,out] | a | where to put the data to read |
[in] | size | says how much data to read |
Implements libdar::generic_file.
|
inlineoverrideprotectedvirtual |
tells the object that several calls to read() will follow to probably obtain at least the given amount of data
[in] | amount | is the maximum expected amount of data that is known to be read |
Implements libdar::generic_file.
Definition at line 79 of file compressor.hpp.
References compressed, and libdar::generic_file::read_ahead().
|
overrideprotectedvirtual |
write down any pending data
Implements libdar::generic_file.
Referenced by skip(), skip_relative(), and skip_to_eof().
|
overrideprotectedvirtual |
destructor-like call, except that it is allowed to throw exceptions
Implements libdar::generic_file.
|
overrideprotectedvirtual |
truncate file at the give offset
Implements libdar::generic_file.
|
overrideprotectedvirtual |
implementation of the write() operation
[in] | a | what data to write |
[in] | size | amount of data to write |
Implements libdar::generic_file.
|
inlineoverridevirtual |
skip at the absolute position
[in] | pos | the offset in byte where next read/write operation must start |
Implements libdar::generic_file.
Definition at line 72 of file compressor.hpp.
References compressed, inherited_flush_read(), inherited_sync_write(), and libdar::generic_file::skip().
|
inlineoverridevirtual |
whether the implementation is able to skip
Implements libdar::generic_file.
Definition at line 71 of file compressor.hpp.
References compressed, and libdar::generic_file::skippable().