Class: Ganapati::HFile

Inherits:
Object
  • Object
show all
Defined in:
lib/ganapati/hfile.rb

Instance Method Summary collapse

Constructor Details

#initialize(client, handle, pathname) ⇒ HFile

Returns a new instance of HFile.



4
5
6
7
8
# File 'lib/ganapati/hfile.rb', line 4

def initialize(client, handle, pathname)
  @client = client
  @handle = handle
  @pathname = pathname
end

Instance Method Details

#closeObject



19
20
21
# File 'lib/ganapati/hfile.rb', line 19

def close
  call :close
end

#lengthObject



27
28
29
# File 'lib/ganapati/hfile.rb', line 27

def length
  stat.length
end

#read(offset = 0, size = nil) ⇒ Object



14
15
16
17
# File 'lib/ganapati/hfile.rb', line 14

def read(offset=0, size=nil)
  size ||= stat.length
  call :read, offset, size
end

#statObject



23
24
25
# File 'lib/ganapati/hfile.rb', line 23

def stat
  @client.stat(@pathname)
end

#write(data) ⇒ Object



10
11
12
# File 'lib/ganapati/hfile.rb', line 10

def write(data)
  call :write, data
end