Class: Elf::Parser::StringTable

Inherits:
Object
  • Object
show all
Defined in:
lib/mithril/parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ StringTable

Returns a new instance of StringTable.



15
16
17
18
# File 'lib/mithril/parser.rb', line 15

def initialize(data)
  expect_value "First byte of string table", data.bytes.first, 0
  @data = StringIO.new(data)
end

Instance Method Details

#[](offset) ⇒ Object



19
20
21
22
23
24
# File 'lib/mithril/parser.rb', line 19

def [](offset)
  @data.seek offset
  obj = BinData::Stringz.new
  obj.read(@data)
  obj.snapshot
end