Class: NTFS::IndexNodeHeader

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

Overview

Here follows a list of IndexNodeEntries.

Constant Summary collapse

NH_HAS_CHILDREN =
0x0001

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(buf) ⇒ IndexNodeHeader

Returns a new instance of IndexNodeHeader.



41
42
43
44
45
46
47
48
49
50
# File 'lib/fs/ntfs/index_node_header.rb', line 41

def initialize(buf)
  raise "MIQ(NTFS::IndexNodeHeader.initialize) Nil buffer" if buf.nil?
  buf  = buf.read(buf.length) if buf.kind_of?(DataRun)
  @inh = INDEX_NODE_HEADER.decode(buf)

  # Get accessor data.
  @flags        = @inh['flags']
  @endEntries   = @inh['index_length']
  @startEntries = @inh['entries_offset']
end

Instance Attribute Details

#endEntriesObject (readonly)

Returns the value of attribute endEntries.



39
40
41
# File 'lib/fs/ntfs/index_node_header.rb', line 39

def endEntries
  @endEntries
end

#flagsObject (readonly)

Returns the value of attribute flags.



39
40
41
# File 'lib/fs/ntfs/index_node_header.rb', line 39

def flags
  @flags
end

#startEntriesObject (readonly)

Returns the value of attribute startEntries.



39
40
41
# File 'lib/fs/ntfs/index_node_header.rb', line 39

def startEntries
  @startEntries
end

Instance Method Details

#dumpObject



60
61
62
63
64
65
66
67
# File 'lib/fs/ntfs/index_node_header.rb', line 60

def dump
  out = "\#<#{self.class}:0x#{'%08x' % object_id}>\n"
  out << "  Entries Offset   : #{@startEntries}\n"
  out << "  Index Length     : #{@endEntries}\n"
  out << "  Allocated Size   : #{@inh['allocated_size']}\n"
  out << "  Flags            : 0x#{'%08x' % @flags}\n"
  out << "---\n"
end

#hasChildren?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/fs/ntfs/index_node_header.rb', line 56

def hasChildren?
  (@flags & NH_HAS_CHILDREN) == NH_HAS_CHILDREN
end

#to_sObject



52
53
54
# File 'lib/fs/ntfs/index_node_header.rb', line 52

def to_s
  "0x#{'%08x' % @flags}"
end