Retrieves the file system type indicator of a file entry.

    Args:
      file_entry (dfvfs.FileEntry): a file entry.

    Returns:
      str: file system type.
499564
def _GetFileSystemTypeFromFileEntry(self, file_entry):
    
    if file_entry.type_indicator != dfvfs_definitions.TYPE_INDICATOR_TSK:
      return file_entry.type_indicator

    # TODO: Implement fs_type in dfVFS and remove this implementation
    # once that is in place.
    file_system = file_entry.GetFileSystem()
    fs_info = file_system.GetFsInfo()
    if fs_info.info:
      type_string = '{0!s}'.format(fs_info.info.ftype)
      if type_string.startswith('TSK_FS_TYPE_'):
        type_string = type_string[12:]
      if type_string.endswith('_DETECT'):
        type_string = type_string[:-7]

    return type_string
677101
private File toFile( Entry entry )
    {
        Stack<String> stack = new Stack<String>();
        Entry entryRoot = entry.getFileSystem().getRoot();
        while ( entry != null && !entryRoot.equals( entry ) )
        {
            String name = entry.getName();
            if ( "..".equals( name ) )
            {
                if ( !stack.isEmpty() )
                {
                    stack.pop();
                }
            }
            else if ( !".".equals( name ) )
            {
                stack.push( name );
            }
            entry = entry.getParent();
        }
        File file = this.root;
        while ( !stack.empty() )
        {
            file = new File( file, (String) stack.pop() );
        }
        return file;
    }
218384
def determine_package_type(filename, args):
    
    if args.package_type:
        package_type = args.package_type
    else:
        logger.info('Detecting file type...')

        package_type = detect_package_type(filename)

        if package_type is None:
            message = 'Could not detect package type of file %r please specify package type with option --package-type' % filename
            logger.error(message)
            raise errors.BinstarError(message)

        logger.info('File type is "%s"', package_type)

    return package_type
1023996
def IsDevice(self):
    
    if self._stat_object is None:
      self._stat_object = self._GetStat()
    if self._stat_object is not None:
      self.entry_type = self._stat_object.type
    return self.entry_type == definitions.FILE_ENTRY_TYPE_DEVICE
1052527
def get_entry(self, entry_id):
        

        if entry_id in self._entries:
            return self._entries[entry_id]
        else:
            entry_offset = entry_id * self.entry_size

            # load entry
            entry = MftEntry(
                filename=self.filename,
                offset=self.offset + entry_offset,
                length=self.entry_size,
                index=entry_id
            )

            # cache entry
            self._entries[entry_id] = entry

            return entry
1010403
def get_filetypes(self):
        # type: () -> List[str]
        
        if not self.is_requestable():
            return [resource.get_file_type() for resource in self.get_resources()]
        return self._get_stringlist_from_commastring('file_types')
775802
def Matches(self, file_entry):
    
    location = getattr(file_entry.path_spec, 'location', None)
    if not location:
      return None

    if '.' not in location:
      return False

    _, _, extension = location.rpartition('.')
    return extension.lower() in self._extensions
1114385
def _get_udf_entry(self, udf_path):
        # type: (str) -> udfmod.UDFFileEntry
        '''
        
        '''
        if self._needs_reshuffle:
            self._reshuffle_extents()

        (ident_unused, rec) = self._find_udf_record(utils.normpath(udf_path))
        if rec is None:
            raise pycdlibexception.PyCdlibInvalidInput('Cannot get entry for empty UDF File Entry')

        return rec
1281067
private int getFileType(String typeInfo) {
        switch (typeInfo) {
            case "ASCII":
                return FTP.ASCII_FILE_TYPE;
            case "BINARY":
                return FTP.BINARY_FILE_TYPE;
            case "EBCDIC":
                return FTP.EBCDIC_FILE_TYPE;
            case "LOCAL":
                return FTP.LOCAL_FILE_TYPE;
            default:
                return FTP.BINARY_FILE_TYPE;
        }
    }
90291
def GetFileEntryByPathSpec(self, path_spec):
    
    if not self.FileEntryExistsByPathSpec(path_spec):
      return None
    return os_file_entry.OSFileEntry(self._resolver_context, self, path_spec)
419715
def _CheckIsPipe(self, file_entry):
    
    if definitions.FILE_ENTRY_TYPE_PIPE not in self._file_entry_types:
      return False
    return file_entry.IsPipe()
705678
def _ReadFileEntries(self, file_object):
    
    self._file_entries = {}

    file_offset = 0
    while file_offset < self._file_size or self._file_size == 0:
      file_entry = self._ReadFileEntry(file_object, file_offset)
      file_offset += file_entry.size
      if file_entry.path == 'TRAILER!!!':
        break

      if file_entry.path in self._file_entries:
        # TODO: alert on file entries with duplicate paths?
        continue

      self._file_entries[file_entry.path] = file_entry
753085
def _GetStat(self):
    
    stat_object = super(FVDEFileEntry, self)._GetStat()

    stat_object.size = self._fvde_volume.get_size()

    return stat_object
1308495
def Match(self, file_entry):
    
    if not file_entry:
      return False

    filename = file_entry.name.lower()
    return filename == self._filename
878438
def filename(self, type_, id_):
        
        profile = self.connection.profile
        return os.path.join(self.directory, profile, type_, str(id_))
1331280
def _GetPlistRootKey(self, file_entry):
    
    file_object = file_entry.GetFileObject()

    try:
      plist_file = plist.PlistFile()
      plist_file.Read(file_object)

    except IOError as exception:
      location = getattr(file_entry.path_spec, 'location', '')
      raise errors.PreProcessFail(
          'Unable to read plist file: {0:s} with error: {1!s}'.format(
              location, exception))

    finally:
      file_object.close()

    return plist_file.root_key
545106
def _EntriesGenerator(self):
    
    location = getattr(self.path_spec, 'location', None)
    if location is not None:
      paths = self._file_system.GetPaths()

      for path in iter(paths.keys()):
        # Determine if the start of the path is similar to the location string.
        # If not the file the path refers to is not in the same directory.
        if not path or not path.startswith(location):
          continue

        _, suffix = self._file_system.GetPathSegmentAndSuffix(location, path)

        # Ignore anything that is part of a sub directory or the directory
        # itself.
        if suffix or path == location:
          continue

        path_spec_location = self._file_system.JoinPath([path])
        yield fake_path_spec.FakePathSpec(location=path_spec_location)