Skip to content

Zlib::GzipReader#level never get updated #1840

Open
robin850 opened this Issue Jul 21, 2014 · 0 comments

1 participant

@robin850

Hello,

JRuby doesn't update at all the compression #level of Zlib::GzipFile or Zlib::GzipReader so the returned value is always "-1". This update happens in gzip_read_header function at the MRI level so since JRuby relies on FFI for the Zlib layer, maybe you just have to use it on your side.

>> require "zlib";
>> require "stringio";
>> gzipped = StringIO.new;
>> writer = Zlib::GzipWriter.new(gzipped, Zlib::BEST_COMPRESSION);
>> writer.write("a");
>> gzipped = StringIO.new(gzipped.string);

>> RUBY_ENGINE
=> "jruby"
>> Zlib::GzipReader.new(gzipped).level
=> -1

>> RUBY_ENGINE
=> "ruby"
>> Zlib::GzipReader.new(gzipped).level
=> 9

Tested with JRuby 1.7.13 and MRI 2.1.2 and 1.9.3.

Have a nice day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.