Top Description Fields Constructors Methods
io.vertx.core.impl.verticle

public Class MemoryFileManager

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

Java in-memory file manager used by CompilingClassLoader to handle compiled classes
Author
Janne Hietamäki

Field Summary

Modifier and TypeField and Description
private final Map<String, ByteArrayOutputStream>
private final PackageHelper
Inherited from javax.tools.ForwardingJavaFileManager:
fileManager

Constructor Summary

AccessConstructor and Description
public
MemoryFileManager(ClassLoader classLoader, JavaFileManager fileManager)

Method Summary

Modifier and TypeMethod and Description
public byte[]
public JavaFileObject
getJavaFileForOutput(JavaFileManager.Location
a package-oriented location
location
,
final 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.

public String
inferBinaryName(JavaFileManager.Location
a location
location
,
JavaFileObject
a file object
file
)

Overrides javax.tools.ForwardingJavaFileManager.inferBinaryName.

Implements javax.tools.JavaFileManager.inferBinaryName.

Infers a binary name of a file object based on a package-oriented location.

public Iterable<JavaFileObject>
list(JavaFileManager.Location
a location
location
,
String
a package name
packageName
,
Set<JavaFileObject.Kind>
return objects only of these kinds
kinds
,
boolean
if true include "subpackages"
recurse
)

Overrides javax.tools.ForwardingJavaFileManager.list.

Implements javax.tools.JavaFileManager.list.

Lists all file objects matching the given criteria in the given package-oriented location.

Inherited from javax.tools.ForwardingJavaFileManager:
closecontainsflushgetClassLoadergetFileForInputgetFileForOutputgetFileForOutputForOriginatingFilesgetJavaFileForInputgetJavaFileForOutputForOriginatingFilesgetLocationForModulegetLocationForModulegetServiceLoaderhandleOptionhasLocationinferModuleNameisSameFileisSupportedOptionlistLocationsForModules

Field Detail

compiledClassesback to summary
private final Map<String, ByteArrayOutputStream> compiledClasses
helperback to summary
private final PackageHelper helper

Constructor Detail

MemoryFileManagerback to summary
public MemoryFileManager(ClassLoader classLoader, JavaFileManager fileManager)

Method Detail

getCompiledClassback to summary
public byte[] getCompiledClass(String name)
getJavaFileForOutputback to summary
public JavaFileObject getJavaFileForOutput(JavaFileManager.Location location, final 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
inferBinaryNameback to summary
public String inferBinaryName(JavaFileManager.Location location, JavaFileObject file)

Overrides javax.tools.ForwardingJavaFileManager.inferBinaryName.

Implements javax.tools.JavaFileManager.inferBinaryName.

Doc from javax.tools.JavaFileManager.inferBinaryName.

Infers a binary name of a file object based on a package-oriented location. The binary name returned might not be a valid binary name according to The Java Language Specification.

Parameters
location:JavaFileManager.Location

a location

file:JavaFileObject

a file object

Returns:String

a binary name or null the file object is not found in the given location

Annotations
@Override
listback to summary
public Iterable<JavaFileObject> list(JavaFileManager.Location location, String packageName, Set<JavaFileObject.Kind> kinds, boolean recurse) throws IOException

Overrides javax.tools.ForwardingJavaFileManager.list.

Implements javax.tools.JavaFileManager.list.

Doc from javax.tools.JavaFileManager.list.

Lists all file objects matching the given criteria in the given package-oriented location. List file objects in "subpackages" if recurse is true.

Note

even if the given location is unknown to this file manager, it may not return null. Also, an unknown location may not cause an exception.

Parameters
location:JavaFileManager.Location

a location

packageName:String

a package name

kinds:Set<JavaFileObject.Kind>

return objects only of these kinds

recurse:boolean

if true include "subpackages"

Returns:Iterable<JavaFileObject>

an Iterable of file objects matching the given criteria

Annotations
@Override
Exceptions
IOException:

Doc from javax.tools.ForwardingJavaFileManager.list.

if an I/O error occurred, or if close has been called and this file manager cannot be reopened