is new.
All Superinterfaces:
FileObject
All Known Implementing Classes:
ForwardingJavaFileObject
,
SimpleJavaFileObject
public interface JavaFileObject
extends
FileObject
File abstraction for tools operating on Java Programming Language source and class files.
A file abstraction for tools operating on Java Programming Language source and class files. In this context, file means an abstraction of regular files and other sources of data. For example, a JavaFileObject can be used to represent regular files, memory cache, or data in databases.
All methods in this interface might throw a SecurityException if a security exception occurs.
Some methods in this interface use class names which, unless specified otherwise, is the binary name of the class as defined in the
Java Language Specification
section 13.1 "The Form of a Binary". Some methods also uses simple names which are defined in section 6.2 "Names and Identifiers".
Unless explicitly allowed, all methods in this interface might throw a NullPointerException if given a null argument.
The case of names is significant. All names should be treated as case-sensitive. For example, some file systems have case-insensitive, case-aware file names and file objects representing such files should take care to preserve case by using java.io.File.getCanonicalFile or similar means. If the system is not case-aware, file objects must use other means to preserve case.
All methods in this interface may throw a SecurityException if a security exception occurs.
File object sometimes have an extension. If a name includes a period (".") the last period and any following text is called the extension.
| Nested Class Summary | |
|---|---|
| static class |
JavaFileObject.Kind
Kinds of JavaFileObjects. |
| Method Summary | |
|---|---|
Modifier
|
getAccessLevel
Provides a hint about the access level of the class represented by
|
|
|
| JavaFileObject.Kind |
getKind
() Gets the kind of this file object. |
NestingKind
|
getNestingKind
Provides a hint about
nesting level
the class represented by
this file object. |
boolean
|
isNameCompatible
(
String
simpleName,
JavaFileObject.Kind
Checks if this file object is compatible with the specified simple name and kind.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Methods inherited from interface javax.tools.
FileObject
|
|---|
delete
,
getCharContent
,
getLastModified
,
getName
,
openInputStream
,
openOutputStream
,
openReader
,
openWriter
,
toUri
|
| Method Detail |
|---|
JavaFileObject.Kind getKind()
isNameCompatible
boolean
StringisNameCompatible
getName(
String
simpleName,
JavaFileObject.Kind
kind)
()
Checks if this file object is compatible with the specified simple name and kind. A simple name is a single identifier (not qualified) as defined in the
Java Language Specification
3rd ed., section 6.2 "Names and Identifiers".
Parameters:
simpleName - a simple name of a class
kind - a kind
Returns:
true if this file object is compatible; false otherwise
getNestingKind
NestingKind
booleangetNestingKind
matches()
(StringsimpleName,JavaFileObject.Kindkind)
Provides a hint about the nesting level of the class represented by this file object. This method may return
NestingKind.MEMBER
to mean
NestingKind.LOCAL
or
NestingKind.ANONYMOUS
. If the nesting level is not known or this file object does not represent a class file this method returns null.
the nesting kind, or null if the nesting kind is not known
getAccessLevel
Modifier
StringgetAccessLevel
getNameWithoutExtension()
Provides a hint about the access level of the class represented by this file object. If the access level is not known or if this file object does not represent a class file this method returns null.
Returns:
the access level
StringgetPath()
longlengthInBytes()
InputStreamopenInputStream() throwsIOException,IllegalStateException,UnsupportedOperationException
OutputStreamopenOutputStream() throwsIOException,IllegalStateException,UnsupportedOperationException
ReaderopenReader() throwsIOException,IllegalStateException,UnsupportedOperationException
CharSequencegetCharContent(boolean ignoreEncodingErrors) throwsIOException,IllegalStateException,UnsupportedOperationException
WriteropenWriter() throwsIOException,IllegalStateException,UnsupportedOperationException
longlastModified()
booleandelete()