def _Open(self, mode='rb'): """Opens the file-like object defined by path specification. Args: mode (Optional[str]): file access mode. Raises: AccessError: if the access to open the file was denied. IOError: if the file-like object could not be opened. NotSupported: if a data stream, like the resource or named fork, is requested to be opened. OSError: if the file-like object could not be opened. PathSpecError: if the path specification is incorrect. """ data_stream = getattr(self._path_spec, 'data_stream', None) if data_stream: raise errors.NotSupported( 'Open data stream: {0:s} not supported.'.format(data_stream)) self._file_system = resolver.Resolver.OpenFileSystem( self._path_spec, resolver_context=self._resolver_context) file_entry = self._file_system.GetFileEntryByPathSpec(self._path_spec) if not file_entry: raise IOError('Unable to open file entry.') fsxfs_file_entry = file_entry.GetXFSFileEntry() if not fsxfs_file_entry: raise IOError('Unable to open XFS file entry.') self._fsxfs_file_entry = fsxfs_file_entry
def NewFileSystem(self, resolver_context): """Creates a new file system. Args: resolver_context (Context): resolver context. Returns: FileSystem: file system. Raises: RuntimeError: if there is no implementation to create a file system. """ raise errors.NotSupported( 'Missing implementation to create file system.')
def NewFileObject(self, resolver_context): """Creates a new file-like object. Args: resolver_context (Context): resolver context. Returns: FileIO: file-like object. Raises: RuntimeError: if there is no implementation to create a file-like object. """ raise errors.NotSupported( 'Missing implementation to create file-like object.')
def NewFileSystem(self, resolver_context, path_spec): """Creates a new file system. Args: resolver_context (Context): resolver context. path_spec (PathSpec): a path specification. Returns: FileSystem: file system. Raises: NotSupported: if there is no implementation to create a file system. """ raise errors.NotSupported('Missing implementation to create file system.')
def NewFileObject(self, resolver_context, path_spec): """Creates a new file input/output (IO) object. Args: resolver_context (Context): resolver context. path_spec (PathSpec): a path specification. Returns: FileIO: file input/output (IO) object. Raises: NotSupported: if there is no implementation to create a file input/output (IO) object. """ raise errors.NotSupported( 'Missing implementation to create file input/output (IO) object.')
def AnalyzeFileObject(self, unused_file_object): """Retrieves the format specification. This is the fall through implementation that raises a RuntimeError. Args: unused_file_object (FileIO): file-like object. Returns: str: type indicator if the file-like object contains a supported format or None otherwise. Raises: NotSupported: since this is the fall through implementation. """ raise errors.NotSupported( 'Missing implementation to analyze file-like object.')