railo.commons.io.res.util
Class ReadOnlyResourceSupport

java.lang.Object
  extended by railo.commons.io.res.util.ResourceSupport
      extended by railo.commons.io.res.util.ReadOnlyResourceSupport
All Implemented Interfaces:
Serializable, Resource
Direct Known Subclasses:
HTTPResource

public abstract class ReadOnlyResourceSupport
extends ResourceSupport

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface railo.commons.io.res.Resource
ATTRIBUTE_ARCHIVE, ATTRIBUTE_HIDDEN, ATTRIBUTE_SYSTEM
 
Constructor Summary
ReadOnlyResourceSupport()
           
 
Method Summary
 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)
           
 
Methods inherited from class railo.commons.io.res.util.ResourceSupport
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
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface railo.commons.io.res.Resource
exists, getInputStream, getName, getParent, getParentResource, getPath, getRealResource, getResourceProvider, isAbsolute, isDirectory, isFile, isReadable, lastModified, length, listResources
 

Constructor Detail

ReadOnlyResourceSupport

public ReadOnlyResourceSupport()
Method Detail

createDirectory

public void createDirectory(boolean createParentWhenNotExists)
                     throws IOException
Description copied from interface: Resource
Creates the directory named by this abstract pathname, including any necessary but nonexistent parent directories if flag "createParentWhenNotExists" is set to true. Note that if this operation fails it may have succeeded in creating some of the necessary parent directories.

Parameters:
createParentWhenNotExists - throws Exception when can't create directory
Throws:
IOException
See Also:
Resource.createDirectory(boolean)

createFile

public void createFile(boolean createParentWhenNotExists)
                throws IOException
Description copied from interface: Resource
Creates a new, empty file named by this abstract pathname if and only if a file with this name does not yet exist. The check for the existence of the file and the creation of the file if it does not exist are a single operation that is atomic with respect to all other filesystem activities that might affect the file.

Throws:
IOException - If an I/O error occurred
See Also:
Resource.createFile(boolean)

isWriteable

public boolean isWriteable()
Description copied from interface: Resource
Tests whether the application can modify the resource denoted by this abstract pathname.

Returns:
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.
See Also:
Resource.isWriteable()

remove

public void remove(boolean force)
            throws IOException
Description copied from interface: Resource
Deletes the resource denoted by this abstract pathname. If this pathname denotes a directory, then the directory must be empty, when argument "force" is set to false, when argument "force" is set to true, also the children of the directory will be deleted.

Throws:
IOException - if the file doesn't exists or can't delete
See Also:
Resource.remove(boolean)

setLastModified

public boolean setLastModified(long time)
Description copied from interface: Resource
Sets the last-modified time of the file or directory named by this abstract pathname.

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 Resource.lastModified() method will return the (possibly truncated) time argument that was passed to this method.

Parameters:
time - The new last-modified time, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970)
Returns:
true if and only if the operation succeeded; false otherwise
See Also:
Resource.setLastModified(long)

setMode

public void setMode(int mode)
             throws IOException
Throws:
IOException
See Also:
Resource.setMode(int)

setReadable

public boolean setReadable(boolean value)
See Also:
Resource.setReadable(boolean)

setWritable

public boolean setWritable(boolean value)
See Also:
Resource.setWritable(boolean)

getOutputStream

public OutputStream getOutputStream(boolean append)
                             throws IOException
Throws:
IOException

getMode

public int getMode()
See Also:
Resource.getMode()


Copyright © 2012 Railo