Top Description Fields Constructors Methods
javax.tools

public Class ForwardingFileObject<F extends FileObject>

extends Object
implements FileObject
Class Inheritance
All Implemented Interfaces
javax.tools.FileObject
Known Direct Subclasses
javax.tools.ForwardingJavaFileObject
Type Parameters
<F>
the kind of file object forwarded to by this object
Imports
java.io.IOException, .InputStream, .OutputStream, .Reader, .Writer, java.net.URI, java.util.Objects

Forwards calls to a given file object. Subclasses of this class might override some of these methods and might also provide additional fields and methods.

Unless stated otherwise, references in this class to "this file object" should be interpreted as referring indirectly to the delegate file object.

Since
1.6

Field Summary

Modifier and TypeField and Description
protected final F
fileObject

The file object to which all methods are delegated.

Constructor Summary

AccessConstructor and Description
protected
ForwardingFileObject(F
delegate to this file object
fileObject
)

Creates a new instance of ForwardingFileObject.

Method Summary

Modifier and TypeMethod and Description
public boolean
delete()

Implements javax.tools.FileObject.delete.

Deletes this file object.
public CharSequence
getCharContent(boolean
ignore encoding errors if true
ignoreEncodingErrors
)

Implements javax.tools.FileObject.getCharContent.

Returns the character content of this file object, if available.
public long
getLastModified()

Implements javax.tools.FileObject.getLastModified.

Returns the time this file object was last modified.
public String
getName()

Implements javax.tools.FileObject.getName.

Returns a user-friendly name for this file object.
public InputStream
openInputStream()

Implements javax.tools.FileObject.openInputStream.

Returns an InputStream for this file object.
public OutputStream
openOutputStream()

Implements javax.tools.FileObject.openOutputStream.

Returns an OutputStream for this file object.
public Reader
openReader(boolean
ignore encoding errors if true
ignoreEncodingErrors
)

Implements javax.tools.FileObject.openReader.

Returns a reader for this object.
public Writer
openWriter()

Implements javax.tools.FileObject.openWriter.

Returns a Writer for this file object.
public URI
toUri()

Implements javax.tools.FileObject.toUri.

Returns a URI identifying this file object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

fileObjectback to summary
protected final F fileObject

The file object to which all methods are delegated.

Constructor Detail

ForwardingFileObjectback to summary
protected ForwardingFileObject(F fileObject)

Creates a new instance of ForwardingFileObject.

Parameters
fileObject:F

delegate to this file object

Method Detail

deleteback to summary
public boolean delete()

Implements javax.tools.FileObject.delete.

Doc from javax.tools.FileObject.delete.

Deletes this file object. In case of errors, returns false.

Returns:boolean

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

Annotations
@Override
getCharContentback to summary
public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException

Implements javax.tools.FileObject.getCharContent.

Doc from javax.tools.FileObject.getCharContent.

Returns 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 ignoreEncodingErrors is true.

Parameters
ignoreEncodingErrors:boolean

ignore encoding errors if true

Returns:CharSequence

a CharSequence if available; null otherwise

Annotations
@Override
Exceptions
IOException:
if an I/O error occurred
IllegalStateException:
if this file object was opened for writing and does not support reading
UnsupportedOperationException:
if this kind of file object does not support character access
getLastModifiedback to summary
public long getLastModified()

Implements javax.tools.FileObject.getLastModified.

Doc from javax.tools.FileObject.getLastModified.

Returns 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:long

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

Annotations
@Override
getNameback to summary
public String getName()

Implements javax.tools.FileObject.getName.

Doc from javax.tools.FileObject.getName.

Returns 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 "BobsApp\Test.java" on the command line, this method should return "BobsApp\Test.java" whereas the toUri method might return file:///C:/Documents%20and%20Settings/UncleBob/BobsApp/Test.java.

Returns:String

a user-friendly name

Annotations
@Override
openInputStreamback to summary
public InputStream openInputStream() throws IOException

Implements javax.tools.FileObject.openInputStream.

Doc from javax.tools.FileObject.openInputStream.

Returns an InputStream for this file object.

Returns:InputStream

an InputStream

Annotations
@Override
Exceptions
IOException:
if an I/O error occurred
IllegalStateException:
if this file object was opened for writing and does not support reading
UnsupportedOperationException:
if this kind of file object does not support byte access
openOutputStreamback to summary
public OutputStream openOutputStream() throws IOException

Implements javax.tools.FileObject.openOutputStream.

Doc from javax.tools.FileObject.openOutputStream.

Returns an OutputStream for this file object.

Returns:OutputStream

an OutputStream

Annotations
@Override
Exceptions
IOException:
if an I/O error occurred
IllegalStateException:
if this file object was opened for reading and does not support writing
UnsupportedOperationException:
if this kind of file object does not support byte access
openReaderback to summary
public Reader openReader(boolean ignoreEncodingErrors) throws IOException

Implements javax.tools.FileObject.openReader.

Doc from javax.tools.FileObject.openReader.

Returns 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 ignoreEncodingErrors is true.

Parameters
ignoreEncodingErrors:boolean

ignore encoding errors if true

Returns:Reader

a Reader

Annotations
@Override
Exceptions
IOException:
if an I/O error occurred
IllegalStateException:
if this file object was opened for writing and does not support reading
UnsupportedOperationException:
if this kind of file object does not support character access
openWriterback to summary
public Writer openWriter() throws IOException

Implements javax.tools.FileObject.openWriter.

Doc from javax.tools.FileObject.openWriter.

Returns a Writer for this file object.

Returns:Writer

a Writer

Annotations
@Override
Exceptions
IOException:
if an I/O error occurred
IllegalStateException:
if this file object was opened for reading and does not support writing
UnsupportedOperationException:
if this kind of file object does not support character access
toUriback to summary
public URI toUri()

Implements javax.tools.FileObject.toUri.

Doc from javax.tools.FileObject.toUri.

Returns a URI identifying this file object.

Returns:URI

a URI

Annotations
@Override