|
Yes, the current implementation buffers the incoming bytes rather than immediately feeding them to the java.util.zip.Deflate class. This means that at a minimum the compression change halfway through is not observed, and with the current implementation it appears to break deflation entirely. Probably not going to get a fix in for 1.1.3, so I'm bumping to 1.1+.
|
||||||||||||||||||||||||||||||||||||||||||||
require 'zlib' data = ('a'..'z').to_a.join d = Zlib::Deflate.new Zlib::NO_COMPRESSION, Zlib::MAX_WBITS, Zlib::DEF_MEM_LEVEL, Zlib::DEFAULT_STRATEGY d << data.slice!(0, 10) d.params Zlib::BEST_COMPRESSION, Zlib::DEFAULT_STRATEGY d << data deflated = d.finish puts "deflated: %p" % deflated inflated = Zlib::Inflate.inflate deflated puts "inflated: %p" % inflatedIt appears that it's the modification of compression params in the middle causing problems. When that line is commented out, deflate works correctly.