Class: Resilience::Image
- Inherits:
-
Object
- Object
- Resilience::Image
- Includes:
- Conf
- Defined in:
- lib/resilience/image.rb
Instance Attribute Summary collapse
-
#bytes_per_sector ⇒ Object
Returns the value of attribute bytes_per_sector.
-
#file ⇒ Object
Returns the value of attribute file.
-
#object_table ⇒ Object
Returns the value of attribute object_table.
-
#object_tree ⇒ Object
Returns the value of attribute object_tree.
-
#offset ⇒ Object
Returns the value of attribute offset.
-
#opts ⇒ Object
Returns the value of attribute opts.
-
#pages ⇒ Object
all pages including shadow pages.
-
#root_dir ⇒ Object
Returns the value of attribute root_dir.
-
#sectors_per_cluster ⇒ Object
Returns the value of attribute sectors_per_cluster.
-
#system_table ⇒ Object
Returns the value of attribute system_table.
Instance Method Summary collapse
- #cluster_size ⇒ Object
-
#initialize(args = {}) ⇒ Image
constructor
A new instance of Image.
- #parse ⇒ Object
- #pos ⇒ Object
- #read(len) ⇒ Object
- #seek(position) ⇒ Object
- #total_pos ⇒ Object
Methods included from Conf
Constructor Details
#initialize(args = {}) ⇒ Image
Returns a new instance of Image.
28 29 30 |
# File 'lib/resilience/image.rb', line 28 def initialize(args={}) @file = args[:file] || [] end |
Instance Attribute Details
#bytes_per_sector ⇒ Object
Returns the value of attribute bytes_per_sector.
13 14 15 |
# File 'lib/resilience/image.rb', line 13 def bytes_per_sector @bytes_per_sector end |
#file ⇒ Object
Returns the value of attribute file.
9 10 11 |
# File 'lib/resilience/image.rb', line 9 def file @file end |
#object_table ⇒ Object
Returns the value of attribute object_table.
22 23 24 |
# File 'lib/resilience/image.rb', line 22 def object_table @object_table end |
#object_tree ⇒ Object
Returns the value of attribute object_tree.
23 24 25 |
# File 'lib/resilience/image.rb', line 23 def object_tree @object_tree end |
#offset ⇒ Object
Returns the value of attribute offset.
10 11 12 |
# File 'lib/resilience/image.rb', line 10 def offset @offset end |
#opts ⇒ Object
Returns the value of attribute opts.
11 12 13 |
# File 'lib/resilience/image.rb', line 11 def opts @opts end |
#pages ⇒ Object
all pages including shadow pages
26 27 28 |
# File 'lib/resilience/image.rb', line 26 def pages @pages end |
#root_dir ⇒ Object
Returns the value of attribute root_dir.
20 21 22 |
# File 'lib/resilience/image.rb', line 20 def root_dir @root_dir end |
#sectors_per_cluster ⇒ Object
Returns the value of attribute sectors_per_cluster.
14 15 16 |
# File 'lib/resilience/image.rb', line 14 def sectors_per_cluster @sectors_per_cluster end |
#system_table ⇒ Object
Returns the value of attribute system_table.
21 22 23 |
# File 'lib/resilience/image.rb', line 21 def system_table @system_table end |
Instance Method Details
#cluster_size ⇒ Object
16 17 18 |
# File 'lib/resilience/image.rb', line 16 def cluster_size @cluster_size ||= bytes_per_sector * sectors_per_cluster end |
#parse ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/resilience/image.rb', line 32 def parse parse_bounds # each of these is a seperate parsing process, # though later ones may depend on former @pages = Resilience::Page.extract_all if conf.pages? @system_table = Resilience::SystemTable.parse @object_table = Resilience::ObjectTable.parse @root_dir = Resilience::RootDir.parse @object_tree = Resilience::ObjectTree.parse if conf.object_tree? end |
#pos ⇒ Object
48 49 50 |
# File 'lib/resilience/image.rb', line 48 def pos @file.pos - offset end |
#read(len) ⇒ Object
56 57 58 |
# File 'lib/resilience/image.rb', line 56 def read(len) @file.read(len) end |
#seek(position) ⇒ Object
44 45 46 |
# File 'lib/resilience/image.rb', line 44 def seek(position) @file.seek offset + position end |
#total_pos ⇒ Object
52 53 54 |
# File 'lib/resilience/image.rb', line 52 def total_pos @file.pos end |