Class: NTFS::FileObject

Inherits:
Object
  • Object
show all
Includes:
NTFS
Defined in:
lib/fs/MiqFS/modules/NTFS.rb

Overview

Top level file object.

Constant Summary

Constants included from NTFS

ATTRIB_ATTRIBUTE_LIST, ATTRIB_FILE_NAME, ATTRIB_INDEX_ROOT, ATTRIB_STANDARD_INFORMATION, ATTRIB_VOLUME_INFORMATION, AT_ATTRIBUTE_LIST, AT_BITMAP, AT_DATA, AT_EA, AT_EA_INFORMATION, AT_END, AT_FILE_NAME, AT_INDEX_ALLOCATION, AT_INDEX_ROOT, AT_LOGGED_UTILITY_STREAM, AT_OBJECT_ID, AT_PROPERTY_SET, AT_REPARSE_POINT, AT_SECURITY_DESCRIPTOR, AT_STANDARD_INFORMATION, AT_SYMBOLIC_LINK, AT_VOLUME_INFORMATION, AT_VOLUME_NAME, AT_VOLUME_VERSION, BOOT_PARAMETERS_BLOCK, DEF_CACHE_SIZE, DIR_INDEX_NODE, FILE_RECORD, INDEX_NODE_HEADER, INDEX_RECORD_HEADER, NTFS_MAGIC, SAH_NONRESIDENT, SAH_RESIDENT, SIZEOF_ATTRIB_ATTRIBUTE_LIST, SIZEOF_ATTRIB_FILE_NAME, SIZEOF_ATTRIB_INDEX_ROOT, SIZEOF_BOOT_PARAMETERS_BLOCK, SIZEOF_DIR_INDEX_NODE, SIZEOF_FILE_RECORD, SIZEOF_INDEX_NODE_HEADER, SIZEOF_INDEX_RECORD_HEADER, SIZEOF_SAH_NONRESIDENT, SIZEOF_SAH_RESIDENT, SIZEOF_STANDARD_ATTRIBUTE_HEADER, STANDARD_ATTRIBUTE_HEADER, TypeName

Instance Attribute Summary collapse

Attributes included from NTFS

#boot_sector, #cache_hits, #drive_root, #index_cache

Instance Method Summary collapse

Methods included from NTFS

#fs_dirEntries, #fs_fileAtime, #fs_fileAtime_obj, #fs_fileClose, #fs_fileCtime, #fs_fileCtime_obj, #fs_fileDirectory?, #fs_fileExists?, #fs_fileFile?, #fs_fileMtime, #fs_fileMtime_obj, #fs_fileOpen, #fs_fileRead, #fs_fileSeek, #fs_fileSize, #fs_fileSize_obj, #fs_freeBytes, #fs_init, #fs_isSymLink?, #getVolumeInfo, #ifs_getDir, #ifs_getFile, #ifs_getIndex, #unnormalizePath

Constructor Details

#initialize(path, miqfs) ⇒ FileObject

fs_fileOpen passes ‘self’ into .. er, ‘this’.



21
22
23
24
# File 'lib/fs/MiqFS/modules/NTFS.rb', line 21

def initialize(path, miqfs)
  @path = path
  @miqfs = miqfs
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



17
18
19
# File 'lib/fs/MiqFS/modules/NTFS.rb', line 17

def data
  @data
end

#dinObject (readonly)

Returns the value of attribute din.



17
18
19
# File 'lib/fs/MiqFS/modules/NTFS.rb', line 17

def din
  @din
end

#miqfsObject (readonly)

Returns the value of attribute miqfs.



17
18
19
# File 'lib/fs/MiqFS/modules/NTFS.rb', line 17

def miqfs
  @miqfs
end

#pathObject (readonly)

Returns the value of attribute path.



17
18
19
# File 'lib/fs/MiqFS/modules/NTFS.rb', line 17

def path
  @path
end

Instance Method Details

#open(_mode = "rb") ⇒ Object



26
27
28
29
30
31
32
33
34
35
# File 'lib/fs/MiqFS/modules/NTFS.rb', line 26

def open(_mode = "rb")
  # NTFS module methods use miqfs instance accessors to
  # touch @boot_sector, @drive_root, @index_cache and @cache_hits
  # (and any other NTFS members that may come later)
  @din = ifs_getFile(@path, @miqfs)
  raise "File not found: '#{@path}'"    if @din.nil?
  mft_entry = @din.resolve(@miqfs.boot_sector)
  raise "File is directory: '#{@path}'" if @din.isDir?
  @data = mft_entry.attributeData || AttribData.new("", 0)
end

#seek(offset, method = IO::SEEK_SET) ⇒ Object



37
38
39
# File 'lib/fs/MiqFS/modules/NTFS.rb', line 37

def seek(offset, method = IO::SEEK_SET)
  @data.seek(offset, method)
end