Class GFileImpl
- All Implemented Interfaces:
GFile
filesystem
.
Only valid while the owning filesystem object is still open and not
closed
.
See GFile
.
-
Constructor Summary
ModifierConstructorDescriptionprotected
GFileImpl
(GFileSystem fileSystem, GFile parentFile, boolean isDirectory, long length, FSRL fsrl) Protected constructor, use static helper methods to create new instances. -
Method Summary
Modifier and TypeMethodDescriptionboolean
static GFileImpl
fromFilename
(GFileSystem fileSystem, GFile parent, String filename, boolean isDirectory, long length, FSRL fsrl) Creates a GFile for a filesystem using a simple name (not a path) and as a child of the specified parent.static GFileImpl
fromFSRL
(GFileSystem fileSystem, GFile parent, FSRL fsrl, boolean isDirectory, long length) Creates a GFile for a filesystem using the information in a FSRL as the file's name and as a child of the specified parent.static GFileImpl
fromPathString
(GFileSystem fileSystem, GFile parent, String path, FSRL fsrl, boolean isDirectory, long length) Creates a GFile for a specific owning filesystem using a string path (ie.static GFileImpl
fromPathString
(GFileSystem fileSystem, String path, FSRL fsrl, boolean isDirectory, long length) Creates a GFile for a filesystem using a string path (ie.TheGFileSystem
that owns this file.getFSRL()
TheFSRL
of this file.long
Returns the length of this file, or -1 if not known.getName()
The name of this file.The parent directory of this file.getPath()
The path and filename of this file, relative to its owning filesystem.int
hashCode()
boolean
Returns true if this is a directory.void
setLength
(long length) toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ghidra.formats.gfilesystem.GFile
getListing
-
Constructor Details
-
GFileImpl
protected GFileImpl(GFileSystem fileSystem, GFile parentFile, boolean isDirectory, long length, FSRL fsrl) Protected constructor, use static helper methods to create new instances.Creates a new GFile instance without any name parsing.
- Parameters:
fileSystem
- theGFileSystem
that owns this fileparentFile
- the parent of the new GFile or null if child-of-root.isDirectory
- boolean flag to indicate that this is a directorylength
- length of the file (use -1 if not know or specified).fsrl
-FSRL
to assign to the file.
-
-
Method Details
-
fromPathString
public static GFileImpl fromPathString(GFileSystem fileSystem, String path, FSRL fsrl, boolean isDirectory, long length) Creates a GFile for a filesystem using a string path (ie. "dir/subdir/filename"), with the path starting at the root of the filesystem.The parents of this GFile are created fresh from any directory names in the path string. It is better to use the
fromFilename(GFileSystem, GFile, String, boolean, long, FSRL)
method to create GFile instances if you can supply the parent value as that will allow reuse of the parent objects instead of duplicates of them being created for each file with the same parent path.- Parameters:
fileSystem
- theGFileSystem
that owns this filepath
- forward slash '/' separated path and filename string.fsrl
-FSRL
to assign to the file, NULL if an auto-created FSRL is ok.isDirectory
- boolean flag to indicate that this is a directorylength
- length of the file (use -1 if not know or specified).- Returns:
- a new
GFileImpl
-
fromPathString
public static GFileImpl fromPathString(GFileSystem fileSystem, GFile parent, String path, FSRL fsrl, boolean isDirectory, long length) Creates a GFile for a specific owning filesystem using a string path (ie. "dir/subdir/filename"), with the path starting at the suppliedparent
directory.The parents of this GFile are created fresh from any directory names in the path string. It is better to use the
fromFilename(GFileSystem, GFile, String, boolean, long, FSRL)
method to create GFile instances if you can supply the parent value as that will allow reuse of the parent objects instead of duplicates of them being created for each file with the same parent path.- Parameters:
fileSystem
- theGFileSystem
that owns this fileparent
- the parent of the new GFile or null if child-of-root.path
- forward slash '/' separated path and filename string.fsrl
-FSRL
to assign to the file, NULL if an auto-created FSRL is ok.isDirectory
- boolean flag to indicate that this is a directorylength
- length of the file (use -1 if not know or specified).- Returns:
- a new
GFileImpl
-
fromFilename
public static GFileImpl fromFilename(GFileSystem fileSystem, GFile parent, String filename, boolean isDirectory, long length, FSRL fsrl) Creates a GFile for a filesystem using a simple name (not a path) and as a child of the specified parent.The filename is accepted without checking or validation.
- Parameters:
fileSystem
- theGFileSystem
that owns this fileparent
- the parent of the new GFile or null if child-of-root.filename
- the file's name, not used if FSRL param specified.isDirectory
- boolean flag to indicate that this is a directorylength
- length of the file (use -1 if not know or specified).fsrl
-FSRL
to assign to the file, NULL if an auto-created FSRL is ok.- Returns:
- a new
GFileImpl
-
fromFSRL
public static GFileImpl fromFSRL(GFileSystem fileSystem, GFile parent, FSRL fsrl, boolean isDirectory, long length) Creates a GFile for a filesystem using the information in a FSRL as the file's name and as a child of the specified parent.- Parameters:
fileSystem
- theGFileSystem
that owns this fileparent
- the parent of the new GFile or null if child-of-root.fsrl
-FSRL
to assign to the file.isDirectory
- boolean flag to indicate that this is a directorylength
- length of the file (use -1 if not know or specified).- Returns:
- a new
GFileImpl
-
getParentFile
Description copied from interface:GFile
The parent directory of this file.- Specified by:
getParentFile
in interfaceGFile
- Returns:
- parent
GFile
directory of this file.
-
getName
Description copied from interface:GFile
The name of this file. -
isDirectory
public boolean isDirectory()Description copied from interface:GFile
Returns true if this is a directory.- Specified by:
isDirectory
in interfaceGFile
- Returns:
- boolean true if this file is a directory, false otherwise.
-
getLength
public long getLength()Description copied from interface:GFile
Returns the length of this file, or -1 if not known. -
getFilesystem
Description copied from interface:GFile
TheGFileSystem
that owns this file.- Specified by:
getFilesystem
in interfaceGFile
- Returns:
GFileSystem
that owns this file.
-
toString
-
getPath
Description copied from interface:GFile
The path and filename of this file, relative to its owning filesystem. -
setLength
public void setLength(long length) -
getFSRL
Description copied from interface:GFile
TheFSRL
of this file. -
hashCode
public int hashCode() -
equals
-