Class: Zlib::Inflate

Inherits:
ZStream show all
Defined in:
ext/rubysl/zlib/zlib.c,
ext/rubysl/zlib/zlib.c

Overview

Zlib:Inflate is the class for decompressing compressed data. Unlike Zlib::Deflate, an instance of this class is not able to duplicate (clone, dup) itself.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ZStream

#adler, #avail_in, #avail_out, #avail_out=, #close, #closed?, #data_type, #end, #ended?, #finish, #finished?, #flush_next_in, #flush_next_out, #reset, #stream_end?, #total_in, #total_out

Constructor Details

#Zlib::Inflate.new(window_bits) ⇒ Object

Creates a new inflate stream for decompression. See zlib.h for details of the argument. If window_bits is nil, the default value is used.

TODO: document better!



1454
1455
1456
# File 'ext/rubysl/zlib/zlib.c', line 1454

static VALUE
rb_inflate_initialize(argc, argv, obj)
int argc;

Class Method Details

.Zlib::Inflate.inflate(string) ⇒ Object

Decompresses string. Raises a Zlib::NeedDict exception if a preset dictionary is needed for decompression.

This method is almost equivalent to the following code:

def inflate(string)
  zstream = Zlib::Inflate.new
  buf = zstream.inflate(string)
  zstream.finish
  zstream.close
  buf
end


1505
1506
1507
# File 'ext/rubysl/zlib/zlib.c', line 1505

static VALUE
rb_inflate_s_inflate(obj, src)
VALUE obj, src;

Instance Method Details

#<<(string) ⇒ Object

Inputs string into the inflate stream just like Zlib::Inflate#inflate, but returns the Zlib::Inflate object itself. The output from the stream is preserved in output buffer.



1596
1597
1598
# File 'ext/rubysl/zlib/zlib.c', line 1596

static VALUE
rb_inflate_addstr(obj, src)
VALUE obj, src;

#inflate(string) ⇒ Object

Inputs string into the inflate stream and returns the output from the stream. Calling this method, both the input and the output buffer of the stream are flushed. If string is nil, this method finishes the stream, just like Zlib::ZStream#finish.

Raises a Zlib::NeedDict exception if a preset dictionary is needed to decompress. Set the dictionary by Zlib::Inflate#set_dictionary and then call this method again with an empty string. (???)

TODO: document better!



1558
1559
1560
# File 'ext/rubysl/zlib/zlib.c', line 1558

static VALUE
rb_inflate_inflate(obj, src)
VALUE obj, src;

#set_dictionaryObject

Sets the preset dictionary and returns string. This method is available just only after a Zlib::NeedDict exception was raised. See zlib.h for details.

TODO: document better!



1669
1670
1671
# File 'ext/rubysl/zlib/zlib.c', line 1669

static VALUE
rb_inflate_set_dictionary(obj, dic)
VALUE obj, dic;

#sync(string) ⇒ Object

Inputs string into the end of input buffer and skips data until a full flush point can be found. If the point is found in the buffer, this method flushes the buffer and returns false. Otherwise it returns true and the following data of full flush point is preserved in the buffer.



1628
1629
1630
# File 'ext/rubysl/zlib/zlib.c', line 1628

static VALUE
rb_inflate_sync(obj, src)
VALUE obj, src;

#sync_point?Boolean

Quoted verbatim from original documentation:

What is this?

:)

Returns:

  • (Boolean)


1646
1647
1648
# File 'ext/rubysl/zlib/zlib.c', line 1646

static VALUE
rb_inflate_sync_point_p(obj)
VALUE obj;