TopBlend:
Here is the
first difference.
There are 46 differences.
is old.
is new.
javax.tools
Interface JavaFileObject
-
All Superinterfaces:
All Known Implementing Classes:
-
FileObject
SimpleJavaFileObject
,
WrapperJavaFileObject
-
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.
-
Since:
-
1.6
-
See Also:
-
JavaFileManager
,
File.getCanonicalFile()
getKind
JavaFileObject.Kind getKind()
-
Gets the kind of this file object.
-
-
-
Returns:
-
the kind
isNameCompatible
getName
boolean
![](../../diffpics/oold.gif)
String
isNameCompatible ![](../../diffpics/oold.gif)
getName
(
String
simpleName,
JavaFileObject.Kind
kind) ![](../../diffpics/oold.gif)
()
-
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".
Gets the base name of this file object. Similar to java.io.File.getName.
-
-
-
Parameters:
Returns:
-
simpleName - a simple name of a class
-
kind - a kind
the base name
-
Returns:
See Also:
-
true if this file object is compatible; false otherwise
File.getName()
getNestingKind
matches
NestingKind![](../../diffpics/oold.gif)
boolean
getNestingKind ![](../../diffpics/oold.gif)
matches
() ![](../../diffpics/oold.gif)
( ![](../../diffpics/oold.gif)
String![](../../diffpics/oold.gif)
simpleName,
![](../../diffpics/oold.gif)
JavaFileObject.Kind![](../../diffpics/oold.gif)
kind)
-
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.
Checks if the name of this file object matches the specified simple name and kind.
-
-
Parameters:
-
simpleName - a simple name of a class
-
kind - a kind
-
Returns:
-
the nesting kind, or null if the nesting kind is not known
true if this file object matches; false otherwise
getAccessLevel
getNameWithoutExtension
Modifier![](../../diffpics/oold.gif)
String
getAccessLevel ![](../../diffpics/oold.gif)
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.
Gets the base name of this file object without any extension.
-
-
Returns:
-
the base name without extention
-
Returns:
See Also:
-
the access level
getName()
getPath
![](../../diffpics/oold.gif)
String![](../../diffpics/oold.gif)
getPath ![](../../diffpics/oold.gif)
()
-
Gets the path to this file object. Similar to java.io.File.getPath.
-
-
Returns:
-
the path; for example, an absolute path
-
See Also:
-
File.getPath()
lengthInBytes
![](../../diffpics/oold.gif)
long ![](../../diffpics/oold.gif)
lengthInBytes ![](../../diffpics/oold.gif)
()
-
Gets the length of this file object in bytes, if byte access is supported.
-
-
Returns:
-
the length in bytes if byte access is supported; -1 otherwise
openInputStream
![](../../diffpics/oold.gif)
InputStream![](../../diffpics/oold.gif)
openInputStream ![](../../diffpics/oold.gif)
()
throws ![](../../diffpics/oold.gif)
IOException![](../../diffpics/oold.gif)
,
![](../../diffpics/oold.gif)
IllegalStateException![](../../diffpics/oold.gif)
,
![](../../diffpics/oold.gif)
UnsupportedOperationException
-
Gets an InputStream for this file object.
-
-
Returns:
-
an InputStream
-
Throws:
-
IllegalStateException
- if this file object was opened for writing and doesn't support reading
-
UnsupportedOperationException
- if this kind of file object doesn't support byte access
-
IOException
- if an I/O error occurred
openOutputStream
![](../../diffpics/oold.gif)
OutputStream![](../../diffpics/oold.gif)
openOutputStream ![](../../diffpics/oold.gif)
()
throws ![](../../diffpics/oold.gif)
IOException![](../../diffpics/oold.gif)
,
![](../../diffpics/oold.gif)
IllegalStateException![](../../diffpics/oold.gif)
,
![](../../diffpics/oold.gif)
UnsupportedOperationException
-
Gets an OutputStream for this file object.
-
-
Returns:
-
an OutputStream
-
Throws:
-
IllegalStateException
- if this file object was opened for reading and doesn't support writing
-
UnsupportedOperationException
- if this kind of file object doesn't support byte access
-
IOException
- if an I/O error occurred
openReader
![](../../diffpics/oold.gif)
Reader![](../../diffpics/oold.gif)
openReader ![](../../diffpics/oold.gif)
()
throws ![](../../diffpics/oold.gif)
IOException![](../../diffpics/oold.gif)
,
![](../../diffpics/oold.gif)
IllegalStateException![](../../diffpics/oold.gif)
,
![](../../diffpics/oold.gif)
UnsupportedOperationException
-
Gets a reader for this object.
-
-
Returns:
-
a Reader
-
Throws:
-
IllegalStateException
- if this file object was opened for writing and doesn't support reading
-
UnsupportedOperationException
- if this kind of file object doesn't support character access
-
IOException
- if an I/O error occurred
getCharContent
![](../../diffpics/oold.gif)
CharSequence![](../../diffpics/oold.gif)
getCharContent ![](../../diffpics/oold.gif)
(boolean ignoreEncodingErrors)
throws ![](../../diffpics/oold.gif)
IOException![](../../diffpics/oold.gif)
,
![](../../diffpics/oold.gif)
IllegalStateException![](../../diffpics/oold.gif)
,
![](../../diffpics/oold.gif)
UnsupportedOperationException
-
Gets the character content of this file object, if available. If encoding errors are ignored, encoding errors will be replaced by the default translation character; otherwise they should be reported as diagnostics.
-
-
Parameters:
-
ignoreEncodingErrors - ignore encoding errors if true
-
Returns:
-
a CharSequence if available; null otherwise
-
Throws:
-
IllegalStateException
- if this file object was opened for writing and doesn't support reading
-
UnsupportedOperationException
- if this kind of file object doesn't support character access
-
IOException
- if an I/O error occurred
openWriter
![](../../diffpics/oold.gif)
Writer![](../../diffpics/oold.gif)
openWriter ![](../../diffpics/oold.gif)
()
throws ![](../../diffpics/oold.gif)
IOException![](../../diffpics/oold.gif)
,
![](../../diffpics/oold.gif)
IllegalStateException![](../../diffpics/oold.gif)
,
![](../../diffpics/oold.gif)
UnsupportedOperationException
-
Gets a Writer for this file object.
-
-
Returns:
-
a Writer
-
Throws:
-
IllegalStateException
- if this file object was opened for reading and doesn't support writing
-
UnsupportedOperationException
- if this kind of file object doesn't support character access
-
IOException
- if an I/O error occurred
lastModified
![](../../diffpics/oold.gif)
long ![](../../diffpics/oold.gif)
lastModified ![](../../diffpics/oold.gif)
()
-
Gets the time this file object was last modified. The time is measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970).
-
-
Returns:
-
the time this file object was last modified; or 0 if the file object does not exist, if an I/O error occured, or if the operation is not supported
delete
![](../../diffpics/oold.gif)
boolean ![](../../diffpics/oold.gif)
delete ![](../../diffpics/oold.gif)
()
-
Delete this file object. In case of errors, return false.
-
-
Returns:
-
true if and only if this file object is successfully deleted; false otherwise