DecompressBzip2

Decompression of data encoded with Bzip2.

This algorithm does not support resource reuse, so calling reset is equivalent to a call to end followed by initialize. (but the same instance of stream is kept).

Members

Aliases

Stream
alias Stream = Bz2Stream
Undocumented in source.

Functions

end
void end(Stream stream)
Undocumented in source. Be warned that the author may not have intended to support it.
initialize
Stream initialize()
Undocumented in source. Be warned that the author may not have intended to support it.
process
Flag!"streamEnded" process(Stream stream, Flag!"lastChunk" )
Undocumented in source. Be warned that the author may not have intended to support it.
reset
void reset(Stream stream)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

small
bool small;

Advanced Bzip2 parameters See Bzip2 documentation https://www.sourceware.org/bzip2/manual/manual.html#bzDecompress-init

verbosity
int verbosity;

Advanced Bzip2 parameters See Bzip2 documentation https://www.sourceware.org/bzip2/manual/manual.html#bzDecompress-init

Examples

import test.util;
import std.array : join;

const len = 100_000;
const phrase = cast(const(ubyte)[]) "Some very repetitive phrase.\n";
const input = generateRepetitiveData(len, phrase).join();

const squized = only(input)
    .compressBzip2()
    .join();

const output = only(squized)
    .decompressBzip2()
    .join();

assert(squized.length < input.length);
assert(output == input);

// for such long and repetitive data, ratio is around 0.12%
const ratio = cast(double) squized.length / cast(double) input.length;
assert(ratio < 0.002);

Meta