Package ghidra.app.script
Class ResourceFileJavaFileManager
java.lang.Object
ghidra.app.script.ResourceFileJavaFileManager
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
,JavaFileManager
,OptionChecker
A
JavaFileManager
that works with Ghidra's ResourceFile
s.
This class is used to dynamically compile Ghidra scripts.
-
Nested Class Summary
Nested classes/interfaces inherited from interface javax.tools.JavaFileManager
JavaFileManager.Location
-
Constructor Summary
ConstructorDescriptionResourceFileJavaFileManager
(List<ResourceFile> sourceDirs, Set<ResourceFile> filesToAvoid) Create aJavaFileManager
for use by theJavaCompiler
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
boolean
contains
(JavaFileManager.Location location, FileObject fo) void
flush()
getClassLoader
(JavaFileManager.Location location) getFileForInput
(JavaFileManager.Location location, String packageName, String relativeName) getFileForOutput
(JavaFileManager.Location location, String packageName, String relativeName, FileObject sibling) getJavaFileForInput
(JavaFileManager.Location location, String className, JavaFileObject.Kind kind) getJavaFileForOutput
(JavaFileManager.Location location, String className, JavaFileObject.Kind kind, FileObject sibling) getLocationForModule
(JavaFileManager.Location location, String moduleName) getLocationForModule
(JavaFileManager.Location location, JavaFileObject fo) <S> ServiceLoader
<S> getServiceLoader
(JavaFileManager.Location location, Class<S> service) boolean
handleOption
(String current, Iterator<String> remaining) boolean
hasLocation
(JavaFileManager.Location location) inferBinaryName
(JavaFileManager.Location location, JavaFileObject file) inferModuleName
(JavaFileManager.Location location) boolean
isSameFile
(FileObject a, FileObject b) int
isSupportedOption
(String option) list
(JavaFileManager.Location location, String packageName, Set<JavaFileObject.Kind> kinds, boolean recurse) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface javax.tools.JavaFileManager
getFileForOutputForOriginatingFiles, getJavaFileForOutputForOriginatingFiles
-
Constructor Details
-
ResourceFileJavaFileManager
Create aJavaFileManager
for use by theJavaCompiler
.- Parameters:
sourceDirs
- the directories containing sourcefilesToAvoid
- known "bad" files to hide from the compiler
-
-
Method Details
-
isSupportedOption
- Specified by:
isSupportedOption
in interfaceOptionChecker
-
getClassLoader
- Specified by:
getClassLoader
in interfaceJavaFileManager
-
list
public Iterable<JavaFileObject> list(JavaFileManager.Location location, String packageName, Set<JavaFileObject.Kind> kinds, boolean recurse) throws IOException - Specified by:
list
in interfaceJavaFileManager
- Throws:
IOException
-
inferBinaryName
- Specified by:
inferBinaryName
in interfaceJavaFileManager
-
isSameFile
- Specified by:
isSameFile
in interfaceJavaFileManager
-
handleOption
- Specified by:
handleOption
in interfaceJavaFileManager
-
hasLocation
- Specified by:
hasLocation
in interfaceJavaFileManager
-
getJavaFileForInput
public JavaFileObject getJavaFileForInput(JavaFileManager.Location location, String className, JavaFileObject.Kind kind) throws IOException - Specified by:
getJavaFileForInput
in interfaceJavaFileManager
- Throws:
IOException
-
getJavaFileForOutput
public JavaFileObject getJavaFileForOutput(JavaFileManager.Location location, String className, JavaFileObject.Kind kind, FileObject sibling) throws IOException - Specified by:
getJavaFileForOutput
in interfaceJavaFileManager
- Throws:
IOException
-
getFileForInput
public FileObject getFileForInput(JavaFileManager.Location location, String packageName, String relativeName) throws IOException - Specified by:
getFileForInput
in interfaceJavaFileManager
- Throws:
IOException
-
getFileForOutput
public FileObject getFileForOutput(JavaFileManager.Location location, String packageName, String relativeName, FileObject sibling) throws IOException - Specified by:
getFileForOutput
in interfaceJavaFileManager
- Throws:
IOException
-
flush
- Specified by:
flush
in interfaceFlushable
- Specified by:
flush
in interfaceJavaFileManager
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceJavaFileManager
- Throws:
IOException
-
getLocationForModule
public JavaFileManager.Location getLocationForModule(JavaFileManager.Location location, String moduleName) throws IOException - Specified by:
getLocationForModule
in interfaceJavaFileManager
- Throws:
IOException
-
getLocationForModule
public JavaFileManager.Location getLocationForModule(JavaFileManager.Location location, JavaFileObject fo) throws IOException - Specified by:
getLocationForModule
in interfaceJavaFileManager
- Throws:
IOException
-
inferModuleName
- Specified by:
inferModuleName
in interfaceJavaFileManager
- Throws:
IOException
-
listLocationsForModules
public Iterable<Set<JavaFileManager.Location>> listLocationsForModules(JavaFileManager.Location location) throws IOException - Specified by:
listLocationsForModules
in interfaceJavaFileManager
- Throws:
IOException
-
contains
- Specified by:
contains
in interfaceJavaFileManager
- Throws:
IOException
-
getServiceLoader
public <S> ServiceLoader<S> getServiceLoader(JavaFileManager.Location location, Class<S> service) throws IOException - Specified by:
getServiceLoader
in interfaceJavaFileManager
- Throws:
IOException
-