StandardJavaFileManager (Java SE 16 & JDK 16) (original) (raw)

All Superinterfaces:

[AutoCloseable](../../../java.base/java/lang/AutoCloseable.html "interface in java.lang"), [Closeable](../../../java.base/java/io/Closeable.html "interface in java.io"), [Flushable](../../../java.base/java/io/Flushable.html "interface in java.io"), [JavaFileManager](JavaFileManager.html "interface in javax.tools"), [OptionChecker](OptionChecker.html "interface in javax.tools")


public interface StandardJavaFileManagerextends JavaFileManager

File manager based on java.io.File and java.nio.file.Path. A common way to obtain an instance of this class is usinggetStandardFileManager, for example:

JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>(); StandardJavaFileManager fm = compiler.getStandardFileManager(diagnostics, null, null);

This file manager creates file objects representing regularfiles,zip file entries, or entries in similar file system based containers. Any file object returned from a file manager implementing this interface must observe the following behavior:

According to these rules, the following URIs, for example, are allowed:

Whereas these are not (reason in parentheses):

All implementations of this interface must support Path objects representing files in the default file system. It is recommended that implementations should support Path objects from any filesystem.

API Note:

Some methods on this interface take a Collection<? extends Path> instead of Iterable<? extends Path>. This is to prevent the possibility of accidentally calling the method with a single Path as such an argument, because althoughPath implements Iterable<Path>, it would almost never be correct to call these methods with a single Path and have it be treated as an Iterable of its components.

Since:

1.6

Nested Classes
static interface
Factory to create Path objects from strings.

Returns the path, if any, underlying this file object (optional operation).
Returns file objects representing the given files.
Returns file objects representing the given file names.
Returns file objects representing the given paths.
Returns file objects representing the given files.
Returns file objects representing the given paths.
Returns file objects representing the given file names.
Returns the search path associated with the given location.
Returns the search path associated with the given location.
boolean
Compares two file objects and return true if they represent the same canonical file, zip file entry, or entry in any file system based container.
void
Associates the given search path with the given location.
default void
Associates the given search path with the given module and location, which must be a module-oriented or output location.
default void
Associates the given search path with the given location.
default void
Specify a factory that can be used to generate a path from a string, or series of strings.

Methods declared in interface javax.tools.JavaFileManager

[close](JavaFileManager.html#close%28%29), [contains](JavaFileManager.html#contains%28javax.tools.JavaFileManager.Location,javax.tools.FileObject%29), [flush](JavaFileManager.html#flush%28%29), [getClassLoader](JavaFileManager.html#getClassLoader%28javax.tools.JavaFileManager.Location%29), [getFileForInput](JavaFileManager.html#getFileForInput%28javax.tools.JavaFileManager.Location,java.lang.String,java.lang.String%29), [getFileForOutput](JavaFileManager.html#getFileForOutput%28javax.tools.JavaFileManager.Location,java.lang.String,java.lang.String,javax.tools.FileObject%29), [getJavaFileForInput](JavaFileManager.html#getJavaFileForInput%28javax.tools.JavaFileManager.Location,java.lang.String,javax.tools.JavaFileObject.Kind%29), [getJavaFileForOutput](JavaFileManager.html#getJavaFileForOutput%28javax.tools.JavaFileManager.Location,java.lang.String,javax.tools.JavaFileObject.Kind,javax.tools.FileObject%29), [getLocationForModule](JavaFileManager.html#getLocationForModule%28javax.tools.JavaFileManager.Location,java.lang.String%29), [getLocationForModule](JavaFileManager.html#getLocationForModule%28javax.tools.JavaFileManager.Location,javax.tools.JavaFileObject%29), [getServiceLoader](JavaFileManager.html#getServiceLoader%28javax.tools.JavaFileManager.Location,java.lang.Class%29), [handleOption](JavaFileManager.html#handleOption%28java.lang.String,java.util.Iterator%29), [hasLocation](JavaFileManager.html#hasLocation%28javax.tools.JavaFileManager.Location%29), [inferBinaryName](JavaFileManager.html#inferBinaryName%28javax.tools.JavaFileManager.Location,javax.tools.JavaFileObject%29), [inferModuleName](JavaFileManager.html#inferModuleName%28javax.tools.JavaFileManager.Location%29), [list](JavaFileManager.html#list%28javax.tools.JavaFileManager.Location,java.lang.String,java.util.Set,boolean%29), [listLocationsForModules](JavaFileManager.html#listLocationsForModules%28javax.tools.JavaFileManager.Location%29)