| oscript.fs.AbstractFile
All known Subclasses: oscript.fs.AbstractAbstractFile,
AbstractFile | public interface AbstractFile (Code) | | An interface to be implemented by something that can implement file-like
operations. Ie read as a stream, write as a stream.
author: Rob Clark (rob@ti.com) |
Method Summary | |
public boolean | canRead() Is it possible to read from this file. | public boolean | canWrite() Is it possible to write to this file. | public boolean | createNewFile() Create a new empty file, if it does not yet exist. | public boolean | delete() Delete this file. | public boolean | exists() Tests whether this file exists. | public String | getExtension() Get the extension, which indicates the type of file. | public java.io.InputStream | getInputStream() Get an input stream to read from this file. | public String | getName() Get the name of this file, which is the last component of the complete path. | public java.io.OutputStream | getOutputStream(boolean append) Get an output stream to write to this file. | public String | getPath() Get the file path, which globally identifies the file. | public boolean | isDirectory() Test whether this file is a directory. | public boolean | isFile() Test whether this file is a regular file. | public long | lastModified() Return the time of last modification. | public long | length() Return the length of the file in bytes. | public boolean | mkdir() If this file does not exist, create it as a directory. | public boolean | mkdirs() If this file does not exist, create it as a directory. | public void | touch() Update the timestamp on this file to the current time. |
canRead | public boolean canRead()(Code) | | Is it possible to read from this file.
|
canWrite | public boolean canWrite()(Code) | | Is it possible to write to this file.
|
createNewFile | public boolean createNewFile() throws java.io.IOException(Code) | | Create a new empty file, if it does not yet exist.
true iff the file does not exist and was successfullycreated. throws: IOException - if error |
delete | public boolean delete() throws java.io.IOException(Code) | | Delete this file. If this file is a directory, then the directory must
be empty.
true iff the directory is successfully deleted. throws: IOException - if error |
exists | public boolean exists()(Code) | | Tests whether this file exists.
true iff the file exists |
getExtension | public String getExtension()(Code) | | Get the extension, which indicates the type of file. Usually the extension
is part of the filename, ie. if the extension was os, the filename
would end with .os.
a string indicating the type of file |
isDirectory | public boolean isDirectory()(Code) | | Test whether this file is a directory.
true iff this file is a directory |
isFile | public boolean isFile()(Code) | | Test whether this file is a regular file. A file is a regular file if
it is not a directory.
true iff this file is a regular file. |
lastModified | public long lastModified()(Code) | | Return the time of last modification. The meaning of these value is not
so important, but the implementation must ensure that a higher value is
returned for the more recent version of a given element. Ie. if at some
point this returns X, an 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.
larger value indicates more recent modification |
length | public long length()(Code) | | Return the length of the file in bytes.
|
mkdir | public boolean mkdir() throws java.io.IOException(Code) | | If this file does not exist, create it as a directory.
true iff directory successfully created |
mkdirs | public boolean mkdirs() throws java.io.IOException(Code) | | If this file does not exist, create it as a directory. All necessary
parent directories are also created. If this operation fails, it may
have successfully created some or all of the parent directories.
true iff directory successfully created |
touch | public void touch() throws java.io.IOException(Code) | | Update the timestamp on this file to the current time.
throws: IOException - if error |
|
|