APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.sun.tools.javac.file

public abstract Class BaseFileManager

extends Object
implements JavaFileManager
Class Inheritance
All Implemented Interfaces
javax.tools.JavaFileManager, javax.tools.OptionChecker, java.io.Flushable, java.io.Closeable, java.lang.AutoCloseable
Known Direct Subclasses
com.sun.tools.javac.file.JavacFileManager
Imports
java.io.IOException, .InputStream, java.lang.ref.SoftReference, java.lang.reflect.Constructor, java.net.URL, .URLClassLoader, java.nio.ByteBuffer, .CharBuffer, java.nio.charset.Charset, .CharsetDecoder, .CoderResult, .CodingErrorAction, .IllegalCharsetNameException, .UnsupportedCharsetException, java.nio.file.NoSuchFileException, .Path, java.util.Collection, .HashMap, .HashSet, .Iterator, .Map, .Objects, .Set, javax.tools.JavaFileManager, .JavaFileObject, .JavaFileObject.Kind, com.sun.tools.javac.code.Lint, .Lint.LintCategory, com.sun.tools.javac.main.Option, .OptionHelper, .OptionHelper.GrumpyHelper, com.sun.tools.javac.resources.CompilerProperties.Errors, .CompilerProperties.LintWarnings, .CompilerProperties.Warnings, com.sun.tools.javac.util.Context, .DefinedBy, .DefinedBy.Api, .Log, .Options

Utility methods for building a file manager. There are no references here to file-system specific objects such as java.io.File or java.nio.file.Path.

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class

Field Summary

Modifier and TypeField and Description
public boolean
autoClose

A flag for clients to use to indicate that this file manager should be closed when it is no longer required.

private byte[]
protected Charset
charset

User provided charset (through javax.tools).

protected final Map<JavaFileObject, BaseFileManager.ContentCacheEntry>
private String
protected long
private static final byte[]
private String
protected static final Set<Option>
private long
protected Lint
protected final Locations
public Log
log

The log to be used for error reporting.

protected String
protected Options
private final HashSet<Path>

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
protected void
public void
public void
protected Locations
public CharBuffer
decode(ByteBuffer inbuf, boolean ignoreEncodingErrors)

protected void
deferredClose()

Wait for a period of inactivity before calling close().

public void
public CharBuffer
protected ClassLoader
public CharsetDecoder
getDecoder(String encodingName, boolean ignoreEncodingErrors)

private String
public String
public static JavaFileObject.Kind
getKind(Path path)

public static JavaFileObject.Kind
public boolean
handleOption(String current, Iterator<String> remaining)

Implements javax.tools.JavaFileManager.handleOption.

Handles one option.

public boolean

Returns:

true if successful, and false otherwise
handleOption
(Option
the option whose value to be set
option
,
String
the value for the option
value
)

Common back end for OptionHelper handleFileManagerOption.

public boolean

Returns:

true if all the calls are successful
handleOptions
(Map<Option, String>
a collection of options and corresponding values
map
)

Call handleOption for collection of options and corresponding values.

public boolean
public boolean
public int
isSupportedOption(String option)

Implements javax.tools.OptionChecker.isSupportedOption.

Determines if the given option is supported and if so, the number of arguments the option takes.

public ByteBuffer

Returns:

a byte buffer containing the contents of the stream
makeByteBuffer
(InputStream
the stream
in
)

Make a ByteBuffer from an input stream.

pack-priv synchronized void
newOutputToPath(Path path)

Record the fact that we have started writing to an output file.

protected static <T> T
nullCheck(T o)

protected static <T> Collection<T>
public void
public synchronized void
public void
setContext(Context
the context containing items to be associated with the file manager
context
)

Set the context for JavacPathFileManager.

pack-priv synchronized void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

autoCloseback to summary
public boolean autoClose

A flag for clients to use to indicate that this file manager should be closed when it is no longer required.

byteArrayCacheback to summary
private byte[] byteArrayCache
charsetback to summary
protected Charset charset

User provided charset (through javax.tools).

contentCacheback to summary
protected final Map<JavaFileObject, BaseFileManager.ContentCacheEntry> contentCache
defaultEncodingNameback to summary
private String defaultEncodingName
deferredCloseTimeoutback to summary
protected long deferredCloseTimeout
EMPTY_ARRAYback to summary
private static final byte[] EMPTY_ARRAY
encodingNameback to summary
private String encodingName
javacFileManagerOptionsback to summary
protected static final Set<Option> javacFileManagerOptions
lastUsedTimeback to summary
private long lastUsedTime
lintback to summary
protected Lint lint
locationsback to summary
protected final Locations locations
logback to summary
public Log log

The log to be used for error reporting.

multiReleaseValueback to summary
protected String multiReleaseValue
optionsback to summary
protected Options options
outputFilesWrittenback to summary
private final HashSet<Path> outputFilesWritten

Constructor Detail

BaseFileManagerback to summary
protected BaseFileManager(Charset charset)
Annotations
@SuppressWarnings:this-escape

Method Detail

applyOptionsback to summary
protected void applyOptions(Options options)
cacheback to summary
public void cache(JavaFileObject file, CharBuffer cb)
clearback to summary
public void clear()
createLocationsback to summary
protected Locations createLocations()
decodeback to summary
public CharBuffer decode(ByteBuffer inbuf, boolean ignoreEncodingErrors)
deferredCloseback to summary
protected void deferredClose()

Wait for a period of inactivity before calling close(). The length of the period of inactivity is given by deferredCloseTimeout

flushCacheback to summary
public void flushCache(JavaFileObject file)
getCachedContentback to summary
public CharBuffer getCachedContent(JavaFileObject file)
getClassLoaderback to summary
protected ClassLoader getClassLoader(URL[] urls)
getDecoderback to summary
public CharsetDecoder getDecoder(String encodingName, boolean ignoreEncodingErrors)
getDefaultEncodingNameback to summary
private String getDefaultEncodingName()
getEncodingNameback to summary
public String getEncodingName()
getKindback to summary
public static JavaFileObject.Kind getKind(Path path)
getKindback to summary
public static JavaFileObject.Kind getKind(String name)
handleOptionback to summary
public boolean handleOption(String current, Iterator<String> remaining)

Implements javax.tools.JavaFileManager.handleOption.

Doc from javax.tools.JavaFileManager.handleOption.

Handles one option. If current is an option to this file manager, it will consume any arguments to that option from remaining and return true, otherwise return false.

Annotations
@Override
@DefinedBy:COMPILER
handleOptionback to summary
public boolean handleOption(Option option, String value)

Common back end for OptionHelper handleFileManagerOption.

Parameters
option:Option

the option whose value to be set

value:String

the value for the option

Returns:boolean

true if successful, and false otherwise

handleOptionsback to summary
public boolean handleOptions(Map<Option, String> map)

Call handleOption for collection of options and corresponding values.

Parameters
map:Map<Option, String>

a collection of options and corresponding values

Returns:boolean

true if all the calls are successful

isDefaultBootClassPathback to summary
public boolean isDefaultBootClassPath()
isDefaultSystemModulesPathback to summary
public boolean isDefaultSystemModulesPath()
isSupportedOptionback to summary
public int isSupportedOption(String option)

Implements javax.tools.OptionChecker.isSupportedOption.

Doc from javax.tools.OptionChecker.isSupportedOption.

Determines if the given option is supported and if so, the number of arguments the option takes.

Annotations
@Override
@DefinedBy:COMPILER
makeByteBufferback to summary
public ByteBuffer makeByteBuffer(InputStream in) throws IOException

Make a ByteBuffer from an input stream.

Parameters
in:InputStream

the stream

Returns:ByteBuffer

a byte buffer containing the contents of the stream

Exceptions
IOException:
if an error occurred while reading the stream
newOutputToPathback to summary
pack-priv synchronized void newOutputToPath(Path path) throws IOException

Record the fact that we have started writing to an output file.

nullCheckback to summary
protected static <T> T nullCheck(T o)
nullCheckback to summary
protected static <T> Collection<T> nullCheck(Collection<T> it)
recycleByteBufferback to summary
public void recycleByteBuffer(ByteBuffer buf)
resetOutputFilesWrittenback to summary
public synchronized void resetOutputFilesWritten()
setContextback to summary
public void setContext(Context context)

Set the context for JavacPathFileManager.

Parameters
context:Context

the context containing items to be associated with the file manager

updateLastUsedTimeback to summary
pack-priv synchronized void updateLastUsedTime()
com.sun.tools.javac.file back to summary

protected Class BaseFileManager.ContentCacheEntry

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final SoftReference<CharBuffer>
pack-priv final long

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv CharBuffer
pack-priv boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

refback to summary
pack-priv final SoftReference<CharBuffer> ref
timestampback to summary
pack-priv final long timestamp

Constructor Detail

ContentCacheEntryback to summary
pack-priv ContentCacheEntry(JavaFileObject file, CharBuffer cb)

Method Detail

getValueback to summary
pack-priv CharBuffer getValue()
isValidback to summary
pack-priv boolean isValid(JavaFileObject file)