F
- the kind of file object forwarded to by this objectpublic class ForwardingFileObject<F extends FileObject> extends Object implements FileObject
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.
protected final F extends FileObject fileObject
The file object which all methods are delegated to.
protected ForwardingFileObject(F fileObject)
Creates a new instance of ForwardingFileObject.
fileObject
- delegate to this file objectpublic URI toUri()
Description copied from interface: FileObject
Returns a URI identifying this file object.
toUri
in interface FileObject
public String getName()
Description copied from interface: FileObject
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 "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
.
getName
in interface FileObject
public InputStream openInputStream() throws IOException
Description copied from interface: FileObject
Gets an InputStream for this file object.
openInputStream
in interface FileObject
IllegalStateException
- if this file object was opened for writing and does not support readingUnsupportedOperationException
- if this kind of file object does not support byte accessIOException
- if an I/O error occurredpublic OutputStream openOutputStream() throws IOException
Description copied from interface: FileObject
Gets an OutputStream for this file object.
openOutputStream
in interface FileObject
IllegalStateException
- if this file object was opened for reading and does not support writingUnsupportedOperationException
- if this kind of file object does not support byte accessIOException
- if an I/O error occurredpublic Reader openReader(boolean ignoreEncodingErrors) throws IOException
Description copied from interface: FileObject
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 ignoreEncodingErrors
is true.
openReader
in interface FileObject
ignoreEncodingErrors
- ignore encoding errors if trueIllegalStateException
- if this file object was opened for writing and does not support readingUnsupportedOperationException
- if this kind of file object does not support character accessIOException
- if an I/O error occurredpublic CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException
Description copied from interface: FileObject
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 ignoreEncodingErrors
is true.
getCharContent
in interface FileObject
ignoreEncodingErrors
- ignore encoding errors if truenull
otherwiseIllegalStateException
- if this file object was opened for writing and does not support readingUnsupportedOperationException
- if this kind of file object does not support character accessIOException
- if an I/O error occurredpublic Writer openWriter() throws IOException
Description copied from interface: FileObject
Gets a Writer for this file object.
openWriter
in interface FileObject
IllegalStateException
- if this file object was opened for reading and does not support writingUnsupportedOperationException
- if this kind of file object does not support character accessIOException
- if an I/O error occurredpublic long getLastModified()
Description copied from interface: FileObject
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).
getLastModified
in interface FileObject
public boolean delete()
Description copied from interface: FileObject
Deletes this file object. In case of errors, returns false.
delete
in interface FileObject
© 1993–2017, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.