deflate(...)
public
Inputs string into the deflate stream and returns the output
from the stream. On calling this method, both the input and the output
buffers of the stream are flushed. If string is nil, this method
finishes the stream, just like Zlib::ZStream#finish.
The value of flush should
be either Zlib::NO_FLUSH, Zlib::SYNC_FLUSH,
Zlib::FULL_FLUSH, or Zlib::FINISH. See zlib.h for
details.
TODO: document better!
Show source
/*
* call-seq: deflate(string[, flush])
*
* Inputs +string+ into the deflate stream and returns the output from the
* stream. On calling this method, both the input and the output buffers of
* the stream are flushed. If +string+ is nil, this method finishes the
* stream, just like Zlib::ZStream#finish.
*
* The value of +flush+ should be either <tt>Zlib::NO_FLUSH</tt>,
* <tt>Zlib::SYNC_FLUSH</tt>, <tt>Zlib::FULL_FLUSH</tt>, or
* <tt>Zlib::FINISH</tt>. See zlib.h for details.
*
* TODO: document better!
*/
static VALUE
rb_deflate_deflate(argc, argv, obj)
int argc;
VALUE *argv;
VALUE obj;
{
struct zstream *z = get_zstream(obj);
VALUE src, flush, dst;
rb_scan_args(argc, argv, "11", &src, &flush);
OBJ_INFECT(obj, src);
do_deflate(z, src, ARG_FLUSH(flush));
dst = zstream_detach_buffer(z);
OBJ_INFECT(dst, obj);
return dst;
}