| javax.tools.StandardJavaFileManager
All known Subclasses: com.sun.tools.javac.util.JavacFileManager,
StandardJavaFileManager | public interface StandardJavaFileManager extends JavaFileManager(Code) | | File manager based on
. A common way
to obtain an instance of this class is using
, for example:
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
DiagnosticCollector diagnostics =
new
DiagnosticCollector() ;
StandardJavaFileManager fm = compiler.getStandardFileManager(diagnostics, null, null);
This file manager creates file objects representing regular
,
, or entries in
similar file system based containers. Any file object returned
from a file manager implementing this interface must observe the
following behavior:
-
File names need not be canonical.
-
For file objects representing regular files
-
the method
is equivalent to
,
-
the method
is equivalent to
,
-
the methods
,
, and
must succeed if the following would succeed (ignoring
encoding issues):
new
(new
(
.
()))
-
and the methods
, and
must
succeed if the following would succeed (ignoring encoding
issues):
new
(new
(
.
()))
-
The
returned from
-
must be
(have a schema), and
-
must have a
which
can be resolved without any process-specific context such
as the current directory (file names must be absolute).
According to these rules, the following URIs, for example, are
allowed:
-
file:///C:/Documents%20and%20Settings/UncleBob/BobsApp/Test.java
-
jar:///C:/Documents%20and%20Settings/UncleBob/lib/vendorA.jar!com/vendora/LibraryClass.class
Whereas these are not (reason in parentheses):
-
file:BobsApp/Test.java (the file name is relative
and depend on the current directory)
-
jar:lib/vendorA.jar!com/vendora/LibraryClass.class
(the first half of the path depends on the current directory,
whereas the component after ! is legal)
-
Test.java (this URI depends on the current
directory and does not have a schema)
-
jar:///C:/Documents%20and%20Settings/UncleBob/BobsApp/../lib/vendorA.jar!com/vendora/LibraryClass.class
(the path is not normalized)
author: Peter von der Ahé since: 1.6 |
getJavaFileObjects | Iterable<? extends JavaFileObject> getJavaFileObjects(File... files)(Code) | | Gets file objects representing the given files.
Convenience method equivalent to:
getJavaFileObjectsFromFiles(
(files))
Parameters: files - an array of files a list of file objects throws: IllegalArgumentException - if the array of files includesa directory throws: NullPointerException - if the given array contains nullelements |
getJavaFileObjects | Iterable<? extends JavaFileObject> getJavaFileObjects(String... names)(Code) | | Gets file objects representing the given file names.
Convenience method equivalent to:
getJavaFileObjectsFromStrings(
(names))
Parameters: names - a list of file names a list of file objects throws: IllegalArgumentException - if the array of file namesincludes a directory throws: NullPointerException - if the given array contains nullelements |
getLocation | Iterable<? extends File> getLocation(Location location)(Code) | | Gets the path associated with the given location.
Parameters: location - a location a list of files or null if this location has noassociated path See Also: StandardJavaFileManager.setLocation |
isSameFile | boolean isSameFile(FileObject a, FileObject b)(Code) | | 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.
Parameters: a - a file object Parameters: b - a file object true if the given file objects represent the samecanonical file or zip file entry; false otherwise throws: IllegalArgumentException - if either of the argumentswere created with another file manager implementation |
setLocation | void setLocation(Location location, Iterable<? extends File> path) throws IOException(Code) | | Associates the given path with the given location. Any
previous value will be discarded.
Parameters: location - a location Parameters: path - a list of files, if null use the defaultpath for this location See Also: StandardJavaFileManager.getLocation throws: IllegalArgumentException - if location is an outputlocation and path does not contain exactly one element throws: IOException - if location is an output location and pathdoes not represent an existing directory |
|
|