| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface StandardJavaFileManager extends JavaFileManager
File manager based on {@linkplain File java.io.File}. A common way to obtain an instance of this class is using {@linkplain JavaCompiler#getStandardFileManager getStandardFileManager}, for example:
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); {@code DiagnosticCollectorThis file manager creates file objects representing regular {@linkplain File files}, {@linkplain java.util.zip.ZipEntry 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:} diagnostics = new {@code DiagnosticCollector ()}; StandardJavaFileManager fm = compiler.getStandardFileManager(diagnostics, null, null);
{@linkplain FileObject#delete()}
is equivalent to {@linkplain File#delete()}
,
{@linkplain FileObject#getLastModified()}
is equivalent to {@linkplain File#lastModified()}
,
{@linkplain FileObject#getCharContent(boolean)}
,
{@linkplain FileObject#openInputStream()}
, and
{@linkplain FileObject#openReader(boolean)}
must succeed if the following would succeed (ignoring
encoding issues):
new {@linkplain java.io.FileInputStream#FileInputStream(File) FileInputStream}(new {@linkplain File#File(java.net.URI) File}({@linkplain FileObject fileObject}.{@linkplain FileObject#toUri() toUri}()))
{@linkplain FileObject#openOutputStream()}
, and
{@linkplain FileObject#openWriter()}
must
succeed if the following would succeed (ignoring encoding
issues):
new {@linkplain java.io.FileOutputStream#FileOutputStream(File) FileOutputStream}(new {@linkplain File#File(java.net.URI) File}({@linkplain FileObject fileObject}.{@linkplain FileObject#toUri() toUri}()))
{@linkplain FileObject#toUri()}
file:///C:/Documents%20and%20Settings/UncleBob/BobsApp/Test.java
jar:///C:/Documents%20and%20Settings/UncleBob/lib/vendorA.jar!com/vendora/LibraryClass.class
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)
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.tools.JavaFileManager |
---|
JavaFileManager.Location |
Method Summary | |
---|---|
Iterable |
getJavaFileObjects(File[] files) Gets file objects representing the given files. |
Iterable |
getJavaFileObjects(String[] names) Gets file objects representing the given file names. |
Iterable |
Gets file objects representing the given files. |
Iterable |
Gets file objects representing the given file names. |
Iterable |
getLocation(JavaFileManager.Location location) Gets the path associated with the given location. |
boolean |
isSameFile(FileObject a, FileObject b) 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 |
setLocation(JavaFileManager.Location location, Iterable path) Associates the given path with the given location. |
Methods inherited from class javax.tools.JavaFileManager |
---|
close, flush, getClassLoader, getFileForInput, getFileForOutput, getJavaFileForInput, getJavaFileForOutput, handleOption, hasLocation, inferBinaryName, isSameFile, list |
Methods inherited from class javax.tools.OptionChecker |
---|
isSupportedOption |
Method Detail |
---|
public Iterable getJavaFileObjects(File[] files)
getJavaFileObjectsFromFiles({@linkplain java.util.Arrays#asList Arrays.asList}(files))
files
- an array of filespublic Iterable getJavaFileObjects(String[] names)
getJavaFileObjectsFromStrings({@linkplain java.util.Arrays#asList Arrays.asList}(names))
names
- a list of file namespublic Iterable getJavaFileObjectsFromFiles(Iterable files)
files
- a list of filespublic Iterable getJavaFileObjectsFromStrings(Iterable names)
names
- a list of file namespublic Iterable getLocation(JavaFileManager.Location location)
location
- a locationpublic boolean isSameFile(FileObject a, FileObject b)
a
- a file objectb
- a file objectpublic void setLocation(JavaFileManager.Location location, Iterable path) throws IOException
location
- a locationpath
- a list of files, if {@code null} use the default
path for this locationIOException
- if location is an output location and path
does not represent an existing directory
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |