This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.tools
interface FileObject

All Known Subinterfaces:
JavaFileObject
All Known Implementing Classes:
ForwardingFileObject, ForwardingJavaFileObject

public interface FileObject

File abstraction for tools. In this context, file means an abstraction of regular files and other sources of data. For example, a file object 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.

Unless explicitly allowed, all methods in this interface might throw a NullPointerException if given a {@code null} argument.


Method Summary
 boolean

          Deletes this file object.
 CharSequence
getCharContent(boolean ignoreEncodingErrors)

          Gets the character content of this file object, if available.
 long

          Gets the time this file object was last modified.
 String

          Gets a user-friendly name for this file object.
 InputStream

          Gets an InputStream for this file object.
 OutputStream

          Gets an OutputStream for this file object.
 Reader
openReader(boolean ignoreEncodingErrors)

          Gets a reader for this object.
 Writer

          Gets a Writer for this file object.
 URI

          Returns a URI identifying this file object.
 

Method Detail

delete

public boolean delete()
Deletes this file object. In case of errors, returns false.

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

getCharContent

public CharSequence getCharContent(boolean ignoreEncodingErrors)
                            throws IOException
Gets the character content of this file object, if available. Any byte that cannot be decoded will be replaced by the default translation character. In addition, a diagnostic may be reported unless {@code ignoreEncodingErrors} is true.

Parameters:
ignoreEncodingErrors - ignore encoding errors if true
Returns:
a CharSequence if available; {@code null} otherwise
Throws:
IOException - if an I/O error occurred

getLastModified

public long getLastModified()
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 occurred, or if the operation is not supported

getName

public String getName()
Gets a user-friendly name for this file object. The exact value returned is not specified but implementations should take care to preserve names as given by the user. For example, if the user writes the filename {@code "BobsApp\Test.java"} on the command line, this method should return {@code "BobsApp\Test.java"} whereas the {@linkplain #toUri toUri} method might return {@code file:///C:/Documents%20and%20Settings/UncleBob/BobsApp/Test.java}.

Returns:
a user-friendly name

openInputStream

public InputStream openInputStream()
                            throws IOException
Gets an InputStream for this file object.

Returns:
an InputStream
Throws:
IOException - if an I/O error occurred

openOutputStream

public OutputStream openOutputStream()
                              throws IOException
Gets an OutputStream for this file object.

Returns:
an OutputStream
Throws:
IOException - if an I/O error occurred

openReader

public Reader openReader(boolean ignoreEncodingErrors)
                  throws IOException
Gets a reader for this object. The returned reader will replace bytes that cannot be decoded with the default translation character. In addition, the reader may report a diagnostic unless {@code ignoreEncodingErrors} is true.

Parameters:
ignoreEncodingErrors - ignore encoding errors if true
Returns:
a Reader
Throws:
IOException - if an I/O error occurred

openWriter

public Writer openWriter()
                  throws IOException
Gets a Writer for this file object.

Returns:
a Writer
Throws:
IOException - if an I/O error occurred

toUri

public URI toUri()
Returns a URI identifying this file object.

Returns:
a URI


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.