def compress(
      level = Zlib::DEFAULT_COMPRESSION,
      window_bits = Zlib::MAX_WBITS,
      mem_level = Zlib::DEF_MEM_LEVEL,
      strategy = Zlib::DEFAULT_STRATEGY
    )
      wrap_with_rewind(@compressed_data, @filtered_data) do
        z = Zlib::Deflate.new level, window_bits, mem_level, strategy
        until @filtered_data.eof? do
          buffer_size = 2 ** 16
          flush = Zlib::NO_FLUSH
          flush = Zlib::FINISH if @filtered_data.size - @filtered_data.pos < buffer_size
          @compressed_data << z.deflate(@filtered_data.read(buffer_size), flush)
        end
        z.finish
        z.close
        truncate_io @compressed_data
      end
      @is_compressed_data_modified = false
      self
    end
def compress(
      level = Zlib::DEFAULT_COMPRESSION,
      window_bits = Zlib::MAX_WBITS,
      mem_level = Zlib::DEF_MEM_LEVEL,
      strategy = Zlib::DEFAULT_STRATEGY
    )
      wrap_with_rewind(@compressed_data, @filtered_data) do
        z = Zlib::Deflate.new level, window_bits, mem_level, strategy
        until @filtered_data.eof? do
          buffer_size = 2 ** 16
          flush = Zlib::NO_FLUSH
          flush = Zlib::FINISH if @filtered_data.size - @filtered_data.pos < buffer_size
          @compressed_data << z.deflate(@filtered_data.read(buffer_size), flush)
        end
        z.finish
        z.close
        truncate_io @compressed_data
      end
      @is_compressed_data_modified = false
      self
    end
Re-compress the filtered data.

 All arguments are for Zlib. See the document of Zlib::Deflate.new for more detail.