Sha256: 457080da011c1f9cefe19b83501fd97a3981a2c6abe750cd43b60b715191b56e

Contents?: true

Size: 525 Bytes

Versions: 1

Compression:

Stored size: 525 Bytes

Contents

module VirtDisk
  class BlockFile
    attr_accessor :path

    def initialize(path)
      @path = path
      @file = defined?(VirtFS) ? VirtFS::VFile.open(path) : File.open(path)
    end

    def block_size
      1
    end

    def size
      @file.size
    end

    def close
      @file.close
    end

    def raw_read(start, len)
      @file.seek start
      @file.read len
    end

    def raw_write(buf, start, len)
      @file.seek start
      @file.write buf, len
    end
  end # class BlockFile
end # module VirtDisk

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
virt_disk-0.0.1 lib/virt_disk/block_file.rb