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()

Nested Class Summary
static class JavaFileObject.Kind
          Kinds of JavaFileObjects.
 
Method Summary
  Modifier  boolean getAccessLevel delete ()
          Provides a hint about the access level of the class represented by           Delete this file object.
  CharSequence getCharContent (boolean ignoreEncodingErrors)
          Gets the character content of this file object, if available.
  JavaFileObject.Kind getKind ()
          Gets the kind of this file object.
  NestingKind String getNestingKind getName ()
          Provides a hint about           Gets the nesting level base name of 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.
  String getNameWithoutExtension ()
          Gets the base name of this file object without any extension.
  String getPath ()
          Gets the path to this file object.
 long lastModified ()
          Gets the time this file object was last modified.
 long lengthInBytes ()
          Gets the length of this file object in bytes, if byte access is supported.
 boolean matches ( String  simpleName, JavaFileObject.Kind
          Checks if the name of this file object matches the specified simple name and kind.
  InputStream openInputStream ()
          Gets an InputStream for this file object.
  OutputStream openOutputStream ()
          Gets an OutputStream for this file object.
  Reader openReader ()
          Gets a reader for this object.
  Writer openWriter ()
          Gets a Writer for this file object.
 
Methods inherited from interface javax.tools. FileObject
delete , getCharContent , getLastModified , getName , openInputStream , openOutputStream , openReader , openWriter , toUri
 

Method Detail

getKind


JavaFileObject.Kind getKind()
Gets the kind of this file object.

Returns:
the kind

isNameCompatible getName


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". 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
boolean getNestingKind matches () ( String simpleName,
 JavaFileObject.Kind 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


 ModifierStringgetAccessLevel 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

 
 StringgetPath () 
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


 
long lengthInBytes () 
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

 
 InputStreamopenInputStream ()
 throws IOException,
 IllegalStateException,
 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

 
 OutputStreamopenOutputStream ()
 throws IOException,
 IllegalStateException,
 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

 
 ReaderopenReader ()
 throws IOException,
 IllegalStateException,
 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

 
 CharSequencegetCharContent (boolean ignoreEncodingErrors)
 throws IOException,
 IllegalStateException,
 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

 
 WriteropenWriter ()
 throws IOException,
 IllegalStateException,
 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


 
long lastModified () 
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


 
boolean delete () 
Delete this file object. In case of errors, return false.

Returns:
true if and only if this file object is successfully deleted; false otherwise