Flowdock
inflate(p1) public

Inputs deflate_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.

If a block is given consecutive inflated chunks from the deflate_string are yielded to the block and nil is returned.

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 to flush the stream:

inflater = Zlib::Inflate.new

begin
  out = inflater.inflate compressed
rescue Zlib::NeedDict
  # ensure the dictionary matches the stream's required dictionary
  raise unless inflater.adler == Zlib.adler32(dictionary)

  inflater.set_dictionary dictionary
  inflater.inflate ''
end

# ...

inflater.close

See also Zlib::Inflate.new

Show source
Register or log in to add new notes.