Package ghidra.app.script
Class ResourceFileJavaFileManager
- java.lang.Object
-
- ghidra.app.script.ResourceFileJavaFileManager
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
,javax.tools.JavaFileManager
,javax.tools.OptionChecker
public class ResourceFileJavaFileManager extends java.lang.Object implements javax.tools.JavaFileManager
AJavaFileManager
that works with Ghidra'sResourceFile
s.This class is used to dynamically compile Ghidra scripts.
-
-
Constructor Summary
Constructors Constructor Description ResourceFileJavaFileManager(java.util.List<ResourceFile> sourceDirs, java.util.Set<ResourceFile> filesToAvoid)
Create aJavaFileManager
for use by theJavaCompiler
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
boolean
contains(javax.tools.JavaFileManager.Location location, javax.tools.FileObject fo)
void
flush()
java.lang.ClassLoader
getClassLoader(javax.tools.JavaFileManager.Location location)
javax.tools.FileObject
getFileForInput(javax.tools.JavaFileManager.Location location, java.lang.String packageName, java.lang.String relativeName)
javax.tools.FileObject
getFileForOutput(javax.tools.JavaFileManager.Location location, java.lang.String packageName, java.lang.String relativeName, javax.tools.FileObject sibling)
javax.tools.JavaFileObject
getJavaFileForInput(javax.tools.JavaFileManager.Location location, java.lang.String className, javax.tools.JavaFileObject.Kind kind)
javax.tools.JavaFileObject
getJavaFileForOutput(javax.tools.JavaFileManager.Location location, java.lang.String className, javax.tools.JavaFileObject.Kind kind, javax.tools.FileObject sibling)
javax.tools.JavaFileManager.Location
getLocationForModule(javax.tools.JavaFileManager.Location location, java.lang.String moduleName)
javax.tools.JavaFileManager.Location
getLocationForModule(javax.tools.JavaFileManager.Location location, javax.tools.JavaFileObject fo)
<S> java.util.ServiceLoader<S>
getServiceLoader(javax.tools.JavaFileManager.Location location, java.lang.Class<S> service)
boolean
handleOption(java.lang.String current, java.util.Iterator<java.lang.String> remaining)
boolean
hasLocation(javax.tools.JavaFileManager.Location location)
java.lang.String
inferBinaryName(javax.tools.JavaFileManager.Location location, javax.tools.JavaFileObject file)
java.lang.String
inferModuleName(javax.tools.JavaFileManager.Location location)
boolean
isSameFile(javax.tools.FileObject a, javax.tools.FileObject b)
int
isSupportedOption(java.lang.String option)
java.lang.Iterable<javax.tools.JavaFileObject>
list(javax.tools.JavaFileManager.Location location, java.lang.String packageName, java.util.Set<javax.tools.JavaFileObject.Kind> kinds, boolean recurse)
java.lang.Iterable<java.util.Set<javax.tools.JavaFileManager.Location>>
listLocationsForModules(javax.tools.JavaFileManager.Location location)
-
-
-
Constructor Detail
-
ResourceFileJavaFileManager
public ResourceFileJavaFileManager(java.util.List<ResourceFile> sourceDirs, java.util.Set<ResourceFile> filesToAvoid)
Create aJavaFileManager
for use by theJavaCompiler
.- Parameters:
sourceDirs
- the directories containing sourcefilesToAvoid
- known "bad" files to hide from the compiler
-
-
Method Detail
-
isSupportedOption
public int isSupportedOption(java.lang.String option)
- Specified by:
isSupportedOption
in interfacejavax.tools.OptionChecker
-
getClassLoader
public java.lang.ClassLoader getClassLoader(javax.tools.JavaFileManager.Location location)
- Specified by:
getClassLoader
in interfacejavax.tools.JavaFileManager
-
list
public java.lang.Iterable<javax.tools.JavaFileObject> list(javax.tools.JavaFileManager.Location location, java.lang.String packageName, java.util.Set<javax.tools.JavaFileObject.Kind> kinds, boolean recurse) throws java.io.IOException
- Specified by:
list
in interfacejavax.tools.JavaFileManager
- Throws:
java.io.IOException
-
inferBinaryName
public java.lang.String inferBinaryName(javax.tools.JavaFileManager.Location location, javax.tools.JavaFileObject file)
- Specified by:
inferBinaryName
in interfacejavax.tools.JavaFileManager
-
isSameFile
public boolean isSameFile(javax.tools.FileObject a, javax.tools.FileObject b)
- Specified by:
isSameFile
in interfacejavax.tools.JavaFileManager
-
handleOption
public boolean handleOption(java.lang.String current, java.util.Iterator<java.lang.String> remaining)
- Specified by:
handleOption
in interfacejavax.tools.JavaFileManager
-
hasLocation
public boolean hasLocation(javax.tools.JavaFileManager.Location location)
- Specified by:
hasLocation
in interfacejavax.tools.JavaFileManager
-
getJavaFileForInput
public javax.tools.JavaFileObject getJavaFileForInput(javax.tools.JavaFileManager.Location location, java.lang.String className, javax.tools.JavaFileObject.Kind kind) throws java.io.IOException
- Specified by:
getJavaFileForInput
in interfacejavax.tools.JavaFileManager
- Throws:
java.io.IOException
-
getJavaFileForOutput
public javax.tools.JavaFileObject getJavaFileForOutput(javax.tools.JavaFileManager.Location location, java.lang.String className, javax.tools.JavaFileObject.Kind kind, javax.tools.FileObject sibling) throws java.io.IOException
- Specified by:
getJavaFileForOutput
in interfacejavax.tools.JavaFileManager
- Throws:
java.io.IOException
-
getFileForInput
public javax.tools.FileObject getFileForInput(javax.tools.JavaFileManager.Location location, java.lang.String packageName, java.lang.String relativeName) throws java.io.IOException
- Specified by:
getFileForInput
in interfacejavax.tools.JavaFileManager
- Throws:
java.io.IOException
-
getFileForOutput
public javax.tools.FileObject getFileForOutput(javax.tools.JavaFileManager.Location location, java.lang.String packageName, java.lang.String relativeName, javax.tools.FileObject sibling) throws java.io.IOException
- Specified by:
getFileForOutput
in interfacejavax.tools.JavaFileManager
- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOException
- Specified by:
flush
in interfacejava.io.Flushable
- Specified by:
flush
in interfacejavax.tools.JavaFileManager
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfacejavax.tools.JavaFileManager
- Throws:
java.io.IOException
-
getLocationForModule
public javax.tools.JavaFileManager.Location getLocationForModule(javax.tools.JavaFileManager.Location location, java.lang.String moduleName) throws java.io.IOException
- Specified by:
getLocationForModule
in interfacejavax.tools.JavaFileManager
- Throws:
java.io.IOException
-
getLocationForModule
public javax.tools.JavaFileManager.Location getLocationForModule(javax.tools.JavaFileManager.Location location, javax.tools.JavaFileObject fo) throws java.io.IOException
- Specified by:
getLocationForModule
in interfacejavax.tools.JavaFileManager
- Throws:
java.io.IOException
-
inferModuleName
public java.lang.String inferModuleName(javax.tools.JavaFileManager.Location location) throws java.io.IOException
- Specified by:
inferModuleName
in interfacejavax.tools.JavaFileManager
- Throws:
java.io.IOException
-
listLocationsForModules
public java.lang.Iterable<java.util.Set<javax.tools.JavaFileManager.Location>> listLocationsForModules(javax.tools.JavaFileManager.Location location) throws java.io.IOException
- Specified by:
listLocationsForModules
in interfacejavax.tools.JavaFileManager
- Throws:
java.io.IOException
-
contains
public boolean contains(javax.tools.JavaFileManager.Location location, javax.tools.FileObject fo) throws java.io.IOException
- Specified by:
contains
in interfacejavax.tools.JavaFileManager
- Throws:
java.io.IOException
-
getServiceLoader
public <S> java.util.ServiceLoader<S> getServiceLoader(javax.tools.JavaFileManager.Location location, java.lang.Class<S> service) throws java.io.IOException
- Specified by:
getServiceLoader
in interfacejavax.tools.JavaFileManager
- Throws:
java.io.IOException
-
-