Class: NTFS::Bitmap

Inherits:
Object
  • Object
show all
Defined in:
lib/fs/ntfs/attrib_bitmap.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(buf) ⇒ Bitmap

Returns a new instance of Bitmap.



21
22
23
24
# File 'lib/fs/ntfs/attrib_bitmap.rb', line 21

def initialize(buf)
  @data   = buf.kind_of?(DataRun) ? buf.read(buf.length) : buf
  @length = @data.length
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



19
20
21
# File 'lib/fs/ntfs/attrib_bitmap.rb', line 19

def data
  @data
end

#lengthObject (readonly)

Returns the value of attribute length.



19
20
21
# File 'lib/fs/ntfs/attrib_bitmap.rb', line 19

def length
  @length
end

Class Method Details

.create_from_header(header, buf) ⇒ Object

BITMAP_ATTR - Attribute: Bitmap (0xb0).

Contains an array of bits (aka a bitfield).

When used in conjunction with the index allocation attribute, each bit corresponds to one index block within the index allocation attribute. Thus the number of bits in the bitmap * index block size / cluster size is the number of clusters in the index allocation attribute.



13
14
15
16
17
# File 'lib/fs/ntfs/attrib_bitmap.rb', line 13

def self.create_from_header(header, buf)
  return Bitmap.new(buf) if header.containsFileNameIndexes?
  $log.debug("Skipping #{header.typeName} for name <#{header.name}>") if $log
  nil
end