public abstract class ReadOnlyResourceSupport extends ResourceSupport
ATTRIBUTE_ARCHIVE, ATTRIBUTE_HIDDEN, ATTRIBUTE_SYSTEM
Constructor and Description |
---|
ReadOnlyResourceSupport() |
Modifier and Type | Method and Description |
---|---|
void |
createDirectory(boolean createParentWhenNotExists)
Creates the directory named by this abstract pathname, including any
necessary but nonexistent parent directories if flag "createParentWhenNotExists" is set to true.
|
void |
createFile(boolean createParentWhenNotExists)
Creates a new, empty file named by this abstract pathname if
and only if a file with this name does not yet exist.
|
int |
getMode() |
OutputStream |
getOutputStream(boolean append) |
boolean |
isWriteable()
Tests whether the application can modify the resource denoted by this
abstract pathname.
|
void |
remove(boolean force)
Deletes the resource denoted by this abstract pathname.
|
boolean |
setLastModified(long time)
Sets the last-modified time of the file or directory named by this
abstract pathname.
|
void |
setMode(int mode) |
boolean |
setReadable(boolean value) |
boolean |
setWritable(boolean value) |
canRead, canWrite, copyFrom, copyTo, createNewFile, delete, equals, getAbsolutePath, getAbsoluteResource, getAttribute, getCanonicalPath, getCanonicalResource, getOutputStream, getReal, isArchive, isHidden, isSystem, list, list, list, listResources, listResources, mkdir, mkdirs, moveTo, renameTo, setArchive, setAttribute, setHidden, setReadOnly, setSystem, toString
getClass, hashCode, notify, notifyAll, wait, wait, wait
exists, getInputStream, getName, getParent, getParentResource, getPath, getRealResource, getResourceProvider, isAbsolute, isDirectory, isFile, isReadable, lastModified, length, listResources
public ReadOnlyResourceSupport()
public void createDirectory(boolean createParentWhenNotExists) throws IOException
Resource
createParentWhenNotExists
- throws Exception when can't create directoryIOException
public void createFile(boolean createParentWhenNotExists) throws IOException
Resource
IOException
- If an I/O error occurredpublic boolean isWriteable()
Resource
true
if and only if the resource system actually
contains a resource denoted by this abstract pathname and
the application is allowed to write to the resource;
false
otherwise.public void remove(boolean force) throws IOException
Resource
IOException
- if the file doesn't exists or can't deletepublic boolean setLastModified(long time)
Resource
All platforms support file-modification times to the nearest second,
but some provide more precision. The argument will be truncated to fit
the supported precision. If the operation succeeds and no intervening
operations on the file take place, then the next invocation of the
method will return the (possibly
truncated) Resource.lastModified()
time
argument that was passed to this method.
time
- The new last-modified time, measured in milliseconds since
the epoch (00:00:00 GMT, January 1, 1970)true
if and only if the operation succeeded;
false
otherwisepublic void setMode(int mode) throws IOException
IOException
public boolean setReadable(boolean value)
public boolean setWritable(boolean value)
public OutputStream getOutputStream(boolean append) throws IOException
IOException
public int getMode()
Copyright © 2015 Lucee