lib/archive/support/zlib.rb
def unbuffered_seek(offset, whence = IO::SEEK_SET)
      unless offset == 0 &&
             ((whence == IO::SEEK_SET && delegate.respond_to?(:rewind)) ||
              whence == IO::SEEK_CUR) then
        raise Errno::EINVAL
      end

      case whence
      when IO::SEEK_SET
        delegate.rewind
        @inflater.close
        @inflater = Zlib::Inflate.new(@window_bits)
        @inflate_buffer = ''
        0
      when IO::SEEK_CUR
        @inflater.total_out - @inflate_buffer.length
      end
    end
def unbuffered_seek(offset, whence = IO::SEEK_SET)
      unless offset == 0 &&
             ((whence == IO::SEEK_SET && delegate.respond_to?(:rewind)) ||
              whence == IO::SEEK_CUR) then
        raise Errno::EINVAL
      end

      case whence
      when IO::SEEK_SET
        delegate.rewind
        @inflater.close
        @inflater = Zlib::Inflate.new(@window_bits)
        @inflate_buffer = ''
        0
      when IO::SEEK_CUR
        @inflater.total_out - @inflate_buffer.length
      end
    end
Allows resetting this object and the delegate object back to the beginning
 of the stream or reporting the current position in the stream.

 Raises Errno::EINVAL unless _offset_ is <tt>0</tt> and _whence_ is either
 IO::SEEK_SET or IO::SEEK_CUR.  Raises Errno::EINVAL if _whence_ is
 IO::SEEK_SEK and the delegate object does not respond to the _rewind_
 method.