module PureRubyZip::ZipHelpers

Public Instance Methods

find_string(file, string) click to toggle source
# File lib/pure_ruby_zip.rb, line 147
def find_string(file, string)
  search_fifo = ""
  while search_fifo != string
    search_fifo = (search_fifo.length == 4 ? search_fifo[1..-1] : search_fifo) + file.read(1)
  end
end
read_int(file, bytes) click to toggle source
# File lib/pure_ruby_zip.rb, line 144
def read_int(file, bytes)
  file.read(bytes).codepoints.each.with_index.reduce(0) { |acc, x| acc + x[0] * (256 ** x[1]) }
end
skip(file, bytes) click to toggle source
# File lib/pure_ruby_zip.rb, line 153
def skip(file, bytes)
  file.read bytes
end