Method: Minitar::Reader#rewind

Defined in:
lib/minitar/reader.rb

#rewindObject

Resets the read pointer to the beginning of data stream. Do not call this during a #each or #each_entry iteration. This only works with random access data streams that respond to #rewind and #pos.



188
189
190
191
192
193
194
195
196
# File 'lib/minitar/reader.rb', line 188

def rewind
  if @init_pos.zero?
    raise Minitar::NonSeekableStream unless Minitar.seekable?(@io, :rewind)
    @io.rewind
  else
    raise Minitar::NonSeekableStream unless Minitar.seekable?(@io, :pos=)
    @io.pos = @init_pos
  end
end