public interface FileObject
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 null argument.
| Modifier and Type | Method and Description |
|---|---|
boolean |
delete()
Deletes this file object.
|
java.lang.CharSequence |
getCharContent(boolean ignoreEncodingErrors)
Gets the character content of this file object, if available.
|
long |
getLastModified()
Gets the time this file object was last modified.
|
java.lang.String |
getName()
Gets a user-friendly name for this file object.
|
java.io.InputStream |
openInputStream()
Gets an InputStream for this file object.
|
java.io.OutputStream |
openOutputStream()
Gets an OutputStream for this file object.
|
java.io.Reader |
openReader(boolean ignoreEncodingErrors)
Gets a reader for this object.
|
java.io.Writer |
openWriter()
Gets a Writer for this file object.
|
java.net.URI |
toUri()
Returns a URI identifying this file object.
|
java.net.URI toUri()
java.lang.String getName()
"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.java.io.InputStream openInputStream()
throws java.io.IOException
java.lang.IllegalStateException - if this file object was
opened for writing and does not support readingjava.lang.UnsupportedOperationException - if this kind of file
object does not support byte accessjava.io.IOException - if an I/O error occurredjava.io.OutputStream openOutputStream()
throws java.io.IOException
java.lang.IllegalStateException - if this file object was
opened for reading and does not support writingjava.lang.UnsupportedOperationException - if this kind of
file object does not support byte accessjava.io.IOException - if an I/O error occurredjava.io.Reader openReader(boolean ignoreEncodingErrors)
throws java.io.IOException
ignoreEncodingErrors is true.ignoreEncodingErrors - ignore encoding errors if truejava.lang.IllegalStateException - if this file object was
opened for writing and does not support readingjava.lang.UnsupportedOperationException - if this kind of
file object does not support character accessjava.io.IOException - if an I/O error occurredjava.lang.CharSequence getCharContent(boolean ignoreEncodingErrors)
throws java.io.IOException
ignoreEncodingErrors is true.ignoreEncodingErrors - ignore encoding errors if truenull otherwisejava.lang.IllegalStateException - if this file object was
opened for writing and does not support readingjava.lang.UnsupportedOperationException - if this kind of
file object does not support character accessjava.io.IOException - if an I/O error occurredjava.io.Writer openWriter()
throws java.io.IOException
java.lang.IllegalStateException - if this file object was
opened for reading and does not support writingjava.lang.UnsupportedOperationException - if this kind of
file object does not support character accessjava.io.IOException - if an I/O error occurredlong getLastModified()
boolean delete()