class MiniMime::Db::PReadFile

For Windows support

Public Class Methods

new(filename) click to toggle source
# File lib/mini_mime.rb, line 93
def initialize(filename)
  @mutex = Mutex.new
  # We must open the file in binary mode
  # otherwise Ruby's automatic line terminator
  # translation will skew the row size
  @file = ::File.open(filename, 'rb')
end

Public Instance Methods

pread(size, offset) click to toggle source
# File lib/mini_mime.rb, line 105
def pread(size, offset)
  @mutex.synchronize do
    @file.seek(offset, IO::SEEK_SET)
    @file.read(size)
  end
end
readline(*args) click to toggle source
# File lib/mini_mime.rb, line 101
def readline(*args)
  @file.readline(*args)
end