Name
SPVM::Compress::Raw::Zlib::Deflate - Low-Level Interface to zlib inflate
Description
Compress::Raw::Zlib::Deflate class in SPVM is a low-level interface to zlib inflate function.
Usage
use Compress::Raw::Zlib::Deflate;
my $d = Compress::Raw::Zlib::Deflate->new($options);
my $output_ref = [(string)undef];
$d->deflate($input, $output_ref);
$d->flush($output_ref);
$d->deflateReset;
$d->deflateParams($options);
$d->deflateTune($good_length, $max_lazy, $nice_length, $max_chain);
$d->adler;
$d->total_in;
$d->total_out;
$d->get_Strategy;
$d->get_Level;
$d->get_BufSize;
Super Class
Class Methods
new
static method new : Compress::Raw::Zlib::Deflate ($options : object[] = undef);
Creates a new Compress::Raw::Zlib::Deflate object, and returns it.
Options:
Level: Int = Z_DEFAULT_COMPRESSIONThe compression level.
Method: Int = Z_DEFLATEDThe compression method.
WindowBits: Int = MAX_WBITSTo compress an RFC 1950 data stream, set WindowBits to a positive number between 8 and 15.
To compress an RFC 1951 data stream, set WindowBits to -
MAX_WBITS.To compress an RFC 1952 data stream (i.e. gzip), set
WindowBitstoWANT_GZIP.For a definition of the meaning and valid values for
WindowBitsrefer to the zlib documentation for deflateInit2.MemLevel: Int = MAX_MEM_LEVELFor a definition of the meaning and valid values for MemLevel refer to the zlib documentation for deflateInit2.
Strategy: Int = Z_DEFAULT_STRATEGYThe strategy used to tune the compression.
Dictionary: Int = undefThe dictionary.
Bufsize: Int = 4096The initial size for the output buffer.
See Compress::Raw::Zlib::Constant about zlib constants.
Instance Methods
deflate
method deflate : int ($input : string, $output_ref : string[]);
Deflates the contents of $input and writes the compressed data to $output_ref->[0].
Returns the zlib status of the last inflate call.
flush
method flush : int ($output_ref : string[], $flush_type : int = -1);
Typically used to finish the deflation.
If $flush_type is a negative value, it is set to Z_FINISH.
Returns the zlib status of the last inflate call.
deflateParams
method deflateParams : void ($options : object[] = undef);
Changes settings of the z_stream object.
Options:
Level: Int = CurrentLevelThe compression level.
Strategy: Int = CurrentStrategyThe strategy used to tune the compression.
deflateReset
method deflateReset : void ();
Reset the z_stream object.
deflateTune
method deflateTune : void ($good_length : int, $max_lazy : int, $nice_length : int, $max_chain : int);
Tune the internal settings of the z_stream object.
get_Strategy
method get_Strategy : int ();
Returns the deflation strategy currently used.
get_Level
method get_Level : int ();
Returns the compression level being used.
DESTROY
method DESTROY : void ();
Finalizes and frees z_stream object.
See Also
Copyright & License
Copyright (c) 2025 Yuki Kimoto
MIT License