Class: Higgs::Tar::RawIO

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/higgs/tar.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(io) ⇒ RawIO

Returns a new instance of RawIO.



124
125
126
# File 'lib/higgs/tar.rb', line 124

def initialize(io)
  @io = io
end

Class Method Details

.open(path, *args) ⇒ Object



118
119
120
121
122
# File 'lib/higgs/tar.rb', line 118

def self.open(path, *args)
  io = File.open(path, *args)
  io.binmode
  RawIO.new(io)
end

Instance Method Details

#pos=(pos) ⇒ Object



150
151
152
# File 'lib/higgs/tar.rb', line 150

def pos=(pos)
  @io.sysseek(pos, IO::SEEK_SET)
end

#read(*args) ⇒ Object



128
129
130
131
132
133
134
# File 'lib/higgs/tar.rb', line 128

def read(*args)
  begin
    @io.sysread(*args)
  rescue EOFError
    nil
  end
end

#seek(*args) ⇒ Object



140
141
142
# File 'lib/higgs/tar.rb', line 140

def seek(*args)
  @io.sysseek(*args)
end

#tellObject Also known as: pos



144
145
146
# File 'lib/higgs/tar.rb', line 144

def tell
  @io.sysseek(0, IO::SEEK_CUR)
end

#write(*args) ⇒ Object



136
137
138
# File 'lib/higgs/tar.rb', line 136

def write(*args)
  @io.syswrite(*args)
end