Class LocalFileSystemSub
- All Implemented Interfaces:
GFileHashProvider
,GFileSystem
,ExtensionPoint
,Closeable
,AutoCloseable
GFileSystem
interface to a part of the user's local / native file system.
This class is a sub-view of the LocalFileSystem
, and returns hybrid GFile objects
that have fully specified FSRL paths that are valid in the Root filesystem, but relative
GFile paths.
This class's name doesn't end with "FileSystem" to ensure it will not be auto-discovered by the FileSystemFactoryMgr.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
getByteProvider
(GFile file, TaskMonitor monitor) Returns aByteProvider
that contains the contents of the specifiedGFile
.Returns a description of this file system.getFileAttributes
(GFile file, TaskMonitor monitor) Returns a container ofFileAttribute
values.getFSRL()
File system's FSRLgetInputStream
(GFile file, TaskMonitor monitor) Returns anInputStream
that contains the contents of the specifiedGFile
.getListing
(GFile directory) Returns a list offiles
that reside in the specified directory on this filesystem.getMD5Hash
(GFile file, boolean required, TaskMonitor monitor) Returns the MD5 hash of the specified file.getName()
File system volume name.Returns theref manager
that is responsible for creating and releasingrefs
to this filesystem.Returns the file system's root directory.getType()
Returns the type of this file system.boolean
isClosed()
Returns true if the filesystem has beenclosed
boolean
isStatic()
Indicates if this filesystem is a static snapshot or changes.Retrieves aGFile
from this filesystem based on its full path and filename, using this filesystem's default name comparison logic (eg.resolveSymlinks
(GFile file) Converts the specified (symlink) file into it's destination, or if not a symlink, returns the original file unchanged.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface ghidra.formats.gfilesystem.GFileSystem
getFileCount
-
Constructor Details
-
LocalFileSystemSub
- Throws:
IOException
-
-
Method Details
-
getType
Description copied from interface:GFileSystem
Returns the type of this file system.This default implementation returns the type value in
FileSystemInfo
annotation.- Specified by:
getType
in interfaceGFileSystem
- Returns:
- type string
-
getDescription
Description copied from interface:GFileSystem
Returns a description of this file system.This default implementation returns the description value in
FileSystemInfo
annotation.- Specified by:
getDescription
in interfaceGFileSystem
- Returns:
- description string
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
isClosed
public boolean isClosed()Description copied from interface:GFileSystem
Returns true if the filesystem has beenclosed
- Specified by:
isClosed
in interfaceGFileSystem
- Returns:
- boolean true if the filesystem has been closed.
-
isStatic
public boolean isStatic()Description copied from interface:GFileSystem
Indicates if this filesystem is a static snapshot or changes.- Specified by:
isStatic
in interfaceGFileSystem
- Returns:
- boolean true if the filesystem is static or false if dynamic content.
-
getListing
Description copied from interface:GFileSystem
Returns a list offiles
that reside in the specified directory on this filesystem.- Specified by:
getListing
in interfaceGFileSystem
- Parameters:
directory
- NULL means root of filesystem.- Returns:
List
ofGFile
instances of file in the requested directory.- Throws:
IOException
- if IO problem.
-
getFileAttributes
Description copied from interface:GFileSystem
Returns a container ofFileAttribute
values.Implementors of this method are not required to add FSRL, NAME, or PATH values unless the values are non-standard.
- Specified by:
getFileAttributes
in interfaceGFileSystem
- Parameters:
file
-GFile
to get the attributes formonitor
-TaskMonitor
- Returns:
FileAttributes
instance (possibly read-only), maybe empty but never null
-
getName
Description copied from interface:GFileSystem
File system volume name.Typically the name of the container file, or a internally stored 'volume' name.
- Specified by:
getName
in interfaceGFileSystem
- Returns:
- string filesystem volume name.
-
getFSRL
Description copied from interface:GFileSystem
File system's FSRL- Specified by:
getFSRL
in interfaceGFileSystem
- Returns:
FSRLRoot
of this filesystem.
-
getRootDir
Description copied from interface:GFileSystem
Returns the file system's root directory.Note: using
null
when callingGFileSystem.getListing(GFile)
is also valid.- Specified by:
getRootDir
in interfaceGFileSystem
- Returns:
- file system's root directory
-
lookup
Description copied from interface:GFileSystem
Retrieves aGFile
from this filesystem based on its full path and filename, using this filesystem's default name comparison logic (eg. case sensitive vs insensitive).- Specified by:
lookup
in interfaceGFileSystem
- Parameters:
path
- string path and filename of a file located in this filesystem. Usenull
or "/" to retrieve the root directory- Returns:
GFile
instance of requested file, null if not found.- Throws:
IOException
- if IO error when looking up file.
-
getInputStream
public InputStream getInputStream(GFile file, TaskMonitor monitor) throws IOException, CancelledException Description copied from interface:GFileSystem
Returns anInputStream
that contains the contents of the specifiedGFile
.The caller is responsible for closing the stream.
- Specified by:
getInputStream
in interfaceGFileSystem
- Parameters:
file
-GFile
to get an InputStream formonitor
-TaskMonitor
to watch and update progress- Returns:
- new
InputStream
contains the contents of the file or NULL if the file doesn't have data. - Throws:
IOException
- if IO problemCancelledException
- if user cancels.
-
getRefManager
Description copied from interface:GFileSystem
Returns theref manager
that is responsible for creating and releasingrefs
to this filesystem.- Specified by:
getRefManager
in interfaceGFileSystem
- Returns:
FileSystemRefManager
that manages references to this filesystem.
-
toString
-
getByteProvider
public ByteProvider getByteProvider(GFile file, TaskMonitor monitor) throws IOException, CancelledException Description copied from interface:GFileSystem
Returns aByteProvider
that contains the contents of the specifiedGFile
.The caller is responsible for closing the provider.
- Specified by:
getByteProvider
in interfaceGFileSystem
- Parameters:
file
-GFile
to get bytes formonitor
-TaskMonitor
to watch and update progress- Returns:
- new
ByteProvider
that contains the contents of the file, or NULL if file doesn't have data - Throws:
IOException
- if errorCancelledException
- if user cancels
-
getMD5Hash
public String getMD5Hash(GFile file, boolean required, TaskMonitor monitor) throws CancelledException, IOException Description copied from interface:GFileHashProvider
Returns the MD5 hash of the specified file.- Specified by:
getMD5Hash
in interfaceGFileHashProvider
- Parameters:
file
- theGFile
required
- boolean flag, if true the hash will always be returned, even if it has to be calculated. If false, the hash will be returned if easily availablemonitor
-TaskMonitor
- Returns:
- MD5 hash as a string
- Throws:
CancelledException
- if cancelledIOException
- if error
-
resolveSymlinks
Description copied from interface:GFileSystem
Converts the specified (symlink) file into it's destination, or if not a symlink, returns the original file unchanged.- Specified by:
resolveSymlinks
in interfaceGFileSystem
- Parameters:
file
- symlink file to follow- Returns:
- destination of symlink, or original file if not a symlink
- Throws:
IOException
- if error following symlink path, typically outside of the hosting file system
-