Class: Rupert::RPM::Signature::Store

Inherits:
Object
  • Object
show all
Defined in:
lib/rupert/rpm/signature/store.rb

Overview

Package information is mostly contained in headers. Headers are composed of an index and a store. The (raw) store holds semantic RPM information in an undefined order and without any structure (i.e. by concatenating all pieces together). Addressing of resources in the store is handled by header entries, which define data format, position and size. Responsibility of the store is to take care of extracting these pieces given proper addressing information.

Instance Method Summary collapse

Constructor Details

#initialize(io) ⇒ Store

Creates a new store by wrapping given chunck of raw data into a Store object.

Parameters:

  • io (IO)

    raw binary data carved from RPM header. Must be an IO containing only store’s data (i.e. entry addresses are considered relative to 0)



19
20
21
# File 'lib/rupert/rpm/signature/store.rb', line 19

def initialize(io)
  @io = io
end

Instance Method Details

#fetch(entry) ⇒ String

Fetches data pointed by given entry.

Parameters:

Returns:

  • (String)

    binary string containing asked data



28
29
30
31
# File 'lib/rupert/rpm/signature/store.rb', line 28

def fetch(entry)
  @io.seek(entry.offset, IO::SEEK_SET)
  @io.read(entry.count)
end