ddn.compressor.deflate_raw

ddn.compressor.deflate_raw

CompressionProvider for raw DEFLATE compression format (RFC 1951). This implements DEFLATE without any container/wrapper (no zlib or gzip headers).

Uses the pure D zlib implementation (ddn.compressor.zlib) with negative windowBits to produce raw DEFLATE streams.

Module Initializers 1

shared static this()

Types 2

Raw DEFLATE compressor using ddn.compressor.zlib with negative windowBits. Produces raw DEFLATE streams without zlib/gzip headers (RFC 1951).

Fields
private CompressionOptions _opts
private z_stream _zs
private OutputSink _sink
private ubyte[] _input
private ubyte[] _output
private int _windowBits
private ulong _bytesIn
private ulong _bytesOut
private bool _dictSet
private bool _finished
Methods
CompressionOptions options() @property constReturn the options used to create this compressor.
void setOutputSink(OutputSink sink)Set the output sink delegate that will receive produced compressed chunks.
void setProgressCallback(ProgressCallback callback)Set an optional progress callback.
ulong bytesInTotal() @property constTotal uncompressed bytes consumed since last reset.
ulong bytesOutTotal() @property constTotal compressed bytes produced since last reset.
void write(const(ubyte)[] data)Write uncompressed data to the compressor.
void flush(FlushMode mode = FlushMode.SYNC)Flush pending output with given flush mode.
void finish()Finish the stream and finalize compression.
void reset()Reset the compressor to initial state.
bool setDictionary(const(ubyte)[] dict)Set compression dictionary for better compression ratios.
bool isFinished() @property constReturns true if finish() has been called and the stream is closed for further writes.
private void compressInternal(int flush)
Constructors
this(CompressionOptions opts)Create a raw DEFLATE compressor with provided options.
Destructors
~thisEnsure zlib stream is ended.

Raw DEFLATE decompressor using ddn.compressor.zlib with negative windowBits. Decompresses raw DEFLATE streams without zlib/gzip headers (RFC 1951).

Fields
private DecompressionOptions _opts
private z_stream _zs
private OutputSink _sink
private ubyte[] _input
private ubyte[] _output
private int _windowBits
private ulong _bytesIn
private ulong _bytesOut
private bool _dictSet
private bool _sawStreamEnd
private bool _finished
Methods
DecompressionOptions options() @property constReturn the options used to create this decompressor.
void setOutputSink(OutputSink sink)Set the output sink delegate that will receive produced decompressed chunks.
void setProgressCallback(ProgressCallback callback)Set an optional progress callback.
ulong bytesInTotal() @property constTotal compressed bytes consumed since last reset.
ulong bytesOutTotal() @property constTotal decompressed bytes produced since last reset.
void write(const(ubyte)[] data)Write compressed data to the decompressor.
void finish()Finish decompression and finalize.
void reset()Reset the decompressor to initial state.
bool setDictionary(const(ubyte)[] dict)Set decompression dictionary for raw DEFLATE streams.
bool isFinished() @property constReturns true if finish() has been called and the stream is closed for further writes.
private void decompressInternal(int flush)
Constructors
this(DecompressionOptions opts)Create a raw DEFLATE decompressor with provided options.
Destructors

Functions 5

fnint toZLevel(CompressionOptions opts)Map ddn CompressionLevel to zlib level.
fnint toZStrategy(CompressionOptions opts)Map ddn CompressionStrategy to zlib strategy.
fnint toZFlush(FlushMode mode)Map ddn FlushMode to zlib flush constant.
fnCompressor makeDeflateRawCompressor(CompressionOptions opts)Factory function that constructs a raw DEFLATE compressor.
fnDecompressor makeDeflateRawDecompressor(DecompressionOptions opts)Factory function that constructs a raw DEFLATE decompressor.