Top Description Fields Constructors Methods
com.sun.tools.javac.launcher

pack-priv final Class MemoryFileManager

extends ForwardingJavaFileManager<JavaFileManager>
Class Inheritance
Imports
javax.tools.FileObject, .ForwardingJavaFileManager, .JavaFileManager, .JavaFileObject, .SimpleJavaFileObject, .StandardLocation, java.io.ByteArrayOutputStream, .IOException, .OutputStream, java.net.URI, java.util.Map

An in-memory file manager.

Class files (of kind CLASS) written to StandardLocation#CLASS_OUTPUT will be written to an in-memory cache. All other file manager operations will be delegated to a specified file manager.

This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.

Field Summary

Modifier and TypeField and Description
private final Map<String, byte[]>
Inherited from javax.tools.ForwardingJavaFileManager:
fileManager

Constructor Summary

AccessConstructor and Description
pack-priv
MemoryFileManager(Map<String, byte[]> map, JavaFileManager delegate)

Method Summary

Modifier and TypeMethod and Description
public boolean
contains(JavaFileManager.Location
the location
location
,
FileObject
the file object
fo
)

Overrides javax.tools.ForwardingJavaFileManager.contains.

Overrides default javax.tools.JavaFileManager.contains.

Determines whether or not a given file object is "contained in" a specified location.

private JavaFileObject
public JavaFileObject
getJavaFileForOutput(JavaFileManager.Location
a package-oriented location
location
,
String
the name of a class
className
,
JavaFileObject.Kind
the kind of file, must be one of SOURCE or CLASS
kind
,
FileObject
a file object to be used as hint for placement; might be null
sibling
)

Overrides javax.tools.ForwardingJavaFileManager.getJavaFileForOutput.

Implements javax.tools.JavaFileManager.getJavaFileForOutput.

Returns a file object for output representing the specified class of the specified kind in the given package-oriented location.

Inherited from javax.tools.ForwardingJavaFileManager:
closeflushgetClassLoadergetFileForInputgetFileForOutputgetFileForOutputForOriginatingFilesgetJavaFileForInputgetJavaFileForOutputForOriginatingFilesgetLocationForModulegetLocationForModulegetServiceLoaderhandleOptionhasLocationinferBinaryNameinferModuleNameisSameFileisSupportedOptionlistlistLocationsForModules

Field Detail

mapback to summary
private final Map<String, byte[]> map

Constructor Detail

MemoryFileManagerback to summary
pack-priv MemoryFileManager(Map<String, byte[]> map, JavaFileManager delegate)

Method Detail

containsback to summary
public boolean contains(JavaFileManager.Location location, FileObject fo) throws IOException

Overrides javax.tools.ForwardingJavaFileManager.contains.

Overrides default javax.tools.JavaFileManager.contains.

Doc from javax.tools.JavaFileManager.contains.

Determines whether or not a given file object is "contained in" a specified location.

For a package-oriented location, a file object is contained in the location if there exist values for packageName and relativeName such that either of the following calls would return the same file object:

getFileForInput(location, packageName, relativeName) getFileForOutput(location, packageName, relativeName, null)
getFileForInput(location, packageName, relativeName)
getFileForOutput(location, packageName, relativeName, null)

For a module-oriented location, a file object is contained in the location if there exists a module that may be obtained by the call:

getLocationForModule(location, moduleName)
getLocationForModule(location, moduleName)
such that the file object is contained in the (package-oriented) location for that module.
Parameters
location:JavaFileManager.Location

the location

fo:FileObject

the file object

Returns:boolean

whether or not the file is contained in the location

Annotations
@Override
Exceptions
IOException:
if there is a problem determining the result
createInMemoryClassFileback to summary
private JavaFileObject createInMemoryClassFile(String className)
getJavaFileForOutputback to summary
public JavaFileObject getJavaFileForOutput(JavaFileManager.Location location, String className, JavaFileObject.Kind kind, FileObject sibling) throws IOException

Overrides javax.tools.ForwardingJavaFileManager.getJavaFileForOutput.

Implements javax.tools.JavaFileManager.getJavaFileForOutput.

Doc from javax.tools.JavaFileManager.getJavaFileForOutput.

Returns a file object for output representing the specified class of the specified kind in the given package-oriented location.

Optionally, this file manager might consider the sibling as a hint for where to place the output. The exact semantics of this hint is unspecified. The JDK compiler, javac, for example, will place class files in the same directories as originating source files unless a class file output directory is provided. To facilitate this behavior, javac might provide the originating source file as sibling when calling this method.

Parameters
location:JavaFileManager.Location

a package-oriented location

className:String

the name of a class

kind:JavaFileObject.Kind

the kind of file, must be one of SOURCE or CLASS

sibling:FileObject

a file object to be used as hint for placement; might be null

Returns:JavaFileObject

a file object for output

Annotations
@Override
Exceptions
IOException:
if an I/O error occurred, or if close has been called and this file manager cannot be reopened