|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
An interface to be implemented by something that can implement file-like operations. Ie read as a stream, write as a stream.
Method Summary | |
boolean |
canRead()
Is it possible to read from this file. |
boolean |
canWrite()
Is it possible to write to this file. |
boolean |
createNewFile()
Create a new empty file, if it does not yet exist. |
boolean |
delete()
Delete this file. |
boolean |
exists()
Tests whether this file exists. |
java.lang.String |
getExtension()
Get the extension, which indicates the type of file. |
java.io.InputStream |
getInputStream()
Get an input stream to read from this file. |
java.lang.String |
getName()
Get the name of this file, which is the last component of the complete path. |
java.io.OutputStream |
getOutputStream(boolean append)
Get an output stream to write to this file. |
java.lang.String |
getPath()
Get the file path, which globally identifies the file. |
boolean |
isDirectory()
Test whether this file is a directory. |
boolean |
isFile()
Test whether this file is a regular file. |
long |
lastModified()
Return the time of last modification. |
long |
length()
Return the length of the file in bytes. |
boolean |
mkdir()
If this file does not exist, create it as a directory. |
boolean |
mkdirs()
If this file does not exist, create it as a directory. |
void |
touch()
Update the timestamp on this file to the current time. |
Method Detail |
public java.io.InputStream getInputStream() throws java.io.IOException
IOException
- if canRead
returns true
canRead()
public java.io.OutputStream getOutputStream(boolean append) throws java.io.IOException
IOException
- if canWrite
returns false
canWrite()
public long lastModified()
AbstractFile
representing the same
"file", but created at a later time, should return X if the file has not
been modified, or >X if the file has been modified.
public long length()
public boolean canRead()
public boolean canWrite()
public boolean exists()
true
iff the file existspublic boolean isDirectory()
true
iff this file is a directorypublic boolean isFile()
true
iff this file is a regular file.public boolean createNewFile() throws java.io.IOException
true
iff the file does not exist and was successfully
created.
IOException
- if errorpublic void touch() throws java.io.IOException
IOException
- if errorpublic boolean delete() throws java.io.IOException
true iff the directory is successfully deleted.
- Throws:
IOException
- if error
public boolean mkdir() throws java.io.IOException
true
iff directory successfully created
java.io.IOException
public boolean mkdirs() throws java.io.IOException
true
iff directory successfully created
java.io.IOException
public java.lang.String getPath()
getName()
public java.lang.String getName()
getPath()
public java.lang.String getExtension()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |