Package ghidra.formats.gfilesystem
Class LocalFileSystemSub
- java.lang.Object
-
- ghidra.formats.gfilesystem.LocalFileSystemSub
-
- All Implemented Interfaces:
GFileSystem,ExtensionPoint,java.io.Closeable,java.lang.AutoCloseable
public class LocalFileSystemSub extends java.lang.Object implements GFileSystem
AGFileSysteminterface 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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ghidra.util.classfinder.ExtensionPoint
ExtensionPoint.Exclude, ExtensionPoint.Util
-
-
Constructor Summary
Constructors Constructor Description LocalFileSystemSub(java.io.File rootDir, GFileSystem rootFS)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()java.lang.StringgetDescription()Returns a description of this file system.FSRLRootgetFSRL()File system's FSRLjava.lang.StringgetInfo(GFile file, TaskMonitor monitor)Returns a multi-line string with information about the specifiedfile.java.io.InputStreamgetInputStream(GFile file, TaskMonitor monitor)Returns anInputStreamthat contains the contents of the specifiedGFile.java.util.List<GFile>getListing(GFile directory)Returns a list offilesthat reside in the specified directory on this filesystem.java.lang.StringgetName()File system volume name.FileSystemRefManagergetRefManager()Returns theref managerthat is responsible for creating and releasingrefsto this filesystem.java.lang.StringgetType()Returns the type of this file system.booleanisClosed()Returns true if the filesystem has beenclosedbooleanisStatic()Indicates if this filesystem is a static snapshot or changes.GFilelookup(java.lang.String path)Retrieves aGFilefrom this filesystem based on its full path and filename.java.lang.StringtoString()-
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 Detail
-
LocalFileSystemSub
public LocalFileSystemSub(java.io.File rootDir, GFileSystem rootFS) throws java.io.IOException- Throws:
java.io.IOException
-
-
Method Detail
-
getType
public java.lang.String getType()
Description copied from interface:GFileSystemReturns the type of this file system.This default implementation returns the type value in
FileSystemInfoannotation.- Specified by:
getTypein interfaceGFileSystem- Returns:
- type string
-
getDescription
public java.lang.String getDescription()
Description copied from interface:GFileSystemReturns a description of this file system.This default implementation returns the description value in
FileSystemInfoannotation.- Specified by:
getDescriptionin interfaceGFileSystem- Returns:
- description string
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
isClosed
public boolean isClosed()
Description copied from interface:GFileSystemReturns true if the filesystem has beenclosed- Specified by:
isClosedin interfaceGFileSystem- Returns:
- boolean true if the filesystem has been closed.
-
isStatic
public boolean isStatic()
Description copied from interface:GFileSystemIndicates if this filesystem is a static snapshot or changes.- Specified by:
isStaticin interfaceGFileSystem- Returns:
- boolean true if the filesystem is static or false if dynamic content.
-
getListing
public java.util.List<GFile> getListing(GFile directory) throws java.io.IOException
Description copied from interface:GFileSystemReturns a list offilesthat reside in the specified directory on this filesystem.- Specified by:
getListingin interfaceGFileSystem- Parameters:
directory- NULL means root of filesystem.- Returns:
ListofGFileinstances of file in the requested directory.- Throws:
java.io.IOException- if IO problem.
-
getInfo
public java.lang.String getInfo(GFile file, TaskMonitor monitor) throws java.io.IOException
Description copied from interface:GFileSystemReturns a multi-line string with information about the specifiedfile.TODO: this method needs to be refactored to return a Map
instead of a pre-formatted multi-line string. - Specified by:
getInfoin interfaceGFileSystem- Parameters:
file-GFileto get info message for.monitor-TaskMonitorto watch and update progress.- Returns:
- multi-line formatted string with info about the file.
- Throws:
java.io.IOException- if IO problem.
-
getName
public java.lang.String getName()
Description copied from interface:GFileSystemFile system volume name.Typically the name of the container file, or a internally stored 'volume' name.
- Specified by:
getNamein interfaceGFileSystem- Returns:
- string filesystem volume name.
-
getFSRL
public FSRLRoot getFSRL()
Description copied from interface:GFileSystemFile system's FSRL- Specified by:
getFSRLin interfaceGFileSystem- Returns:
FSRLRootof this filesystem.
-
lookup
public GFile lookup(java.lang.String path) throws java.io.IOException
Description copied from interface:GFileSystemRetrieves aGFilefrom this filesystem based on its full path and filename.- Specified by:
lookupin interfaceGFileSystem- Parameters:
path- string path and filename of a file located in this filesystem- Returns:
GFileinstance of requested file, null if not found.- Throws:
java.io.IOException- if IO error when looking up file.
-
getInputStream
public java.io.InputStream getInputStream(GFile file, TaskMonitor monitor) throws java.io.IOException, CancelledException
Description copied from interface:GFileSystemReturns anInputStreamthat contains the contents of the specifiedGFile.The caller is responsible for closing the stream.
- Specified by:
getInputStreamin interfaceGFileSystem- Parameters:
file-GFileto get an InputStream formonitor-TaskMonitorto watch and update progress- Returns:
- new
InputStreamcontains the contents of the file or NULL if the file doesn't have data. - Throws:
java.io.IOException- if IO problemCancelledException- if user cancels.
-
getRefManager
public FileSystemRefManager getRefManager()
Description copied from interface:GFileSystemReturns theref managerthat is responsible for creating and releasingrefsto this filesystem.- Specified by:
getRefManagerin interfaceGFileSystem- Returns:
FileSystemRefManagerthat manages references to this filesystem.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-