class Resilience::FSDir::FileEntry
Attributes
metadata[RW]
metadata_attrs[RW]
known metadata attributes
name[RW]
prefix[RW]
record[RW]
metadata record
Public Class Methods
new(args={})
click to toggle source
# File lib/resilience/fs_dir/file_entry.rb, line 20 def initialize(args={}) @prefix = args[:prefix] @name = args[:name] @metadata = args[:metadata] @record = args[:record] parse_attrs end
Public Instance Methods
fullname()
click to toggle source
# File lib/resilience/fs_dir/file_entry.rb, line 28 def fullname "#{prefix}\\#{name}" end
parse_attrs()
click to toggle source
# File lib/resilience/fs_dir/file_entry.rb, line 36 def parse_attrs metadata_bytes = @metadata.unpack('C*') metadata_dwords = @metadata.unpack('L*') attr1_length = metadata_dwords[0] attr1_dwords = attr1_length/4 attr2_length = metadata_dwords[attr1_dwords] attr2_dwords = attr2_length/4 attr3_length = metadata_dwords[attr1_dwords + attr2_dwords] # there may be other attrs after this point... attr1 = metadata_bytes[0..attr1_length] attr2 = metadata_bytes[attr1_length..attr1_length+attr2_length] attr3 = metadata_bytes[attr1_length+attr2_length..attr1_length+attr2_length+attr3_length] @metadata_attrs = [attr1, attr2, attr3] end
total_offset()
click to toggle source
# File lib/resilience/fs_dir/file_entry.rb, line 32 def total_offset image.offset + record.attribute.pos end