railo.commons.io.res.util
Class FileWrapper

java.lang.Object
  extended by java.io.File
      extended by railo.commons.io.res.util.FileWrapper
All Implemented Interfaces:
Serializable, Comparable<File>, Resource

public final class FileWrapper
extends File
implements Resource

See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.io.File
pathSeparator, pathSeparatorChar, separator, separatorChar
 
Fields inherited from interface railo.commons.io.res.Resource
ATTRIBUTE_ARCHIVE, ATTRIBUTE_HIDDEN, ATTRIBUTE_SYSTEM
 
Method Summary
 boolean canRead()
          Tests whether the application can read the resource denoted by this abstract pathname.
 boolean canWrite()
          Tests whether the application can modify the resource denoted by this abstract pathname.
 int compareTo(File pathname)
           
 void copyFrom(Resource res, boolean append)
          copy data of given resource to current
 void copyTo(Resource res, boolean append)
          copy current resource data to given resource
 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.
 boolean createNewFile()
          Creates a new, empty file named by this abstract pathname if and only if a file with this name does not yet exist.
 boolean delete()
          Deletes the resource denoted by this abstract pathname.
 void deleteOnExit()
           
 boolean equals(Object obj)
           
 boolean exists()
          Tests whether the resource denoted by this abstract pathname exists.
 File getAbsoluteFile()
           
 String getAbsolutePath()
          Returns the absolute pathname string of this abstract pathname.
 Resource getAbsoluteResource()
          Returns the absolute form of this abstract pathname.
 boolean getAttribute(short attribute)
          return value of a specific attribute
 File getCanonicalFile()
           
 String getCanonicalPath()
          Returns the canonical pathname string of this abstract pathname.
 Resource getCanonicalResource()
          Returns the canonical form of this abstract pathname.
 InputStream getInputStream()
           
 int getMode()
           
 String getName()
          Returns the name of the resource denoted by this abstract pathname.
 OutputStream getOutputStream()
           
 OutputStream getOutputStream(boolean append)
           
 String getParent()
          Returns the pathname string of this abstract pathname's parent, or null if this pathname does not name a parent directory.
 File getParentFile()
           
 Resource getParentResource()
          Returns the abstract pathname of this abstract pathname's parent, or null if this pathname does not name a parent directory.
 String getPath()
          Converts this abstract pathname into a pathname string.
 String getReal(String realpath)
          returns a resource path that is relative to the current resource
 Resource getRealResource(String realpath)
          returns a resource that is relative to the current resource
 ResourceProvider getResourceProvider()
           
 int hashCode()
           
 boolean isAbsolute()
          Tests whether this abstract pathname is absolute.
 boolean isArchive()
          Tests whether the resource named by this abstract pathname is a archive resource.
 boolean isDirectory()
          Tests whether the resource denoted by this abstract pathname is a directory.
 boolean isFile()
          Tests whether the file denoted by this abstract pathname is a normal file.
 boolean isHidden()
          Tests whether the resource named by this abstract pathname is a hidden resource.
 boolean isReadable()
          Tests whether the application can read the resource denoted by this abstract pathname.
 boolean isSystem()
          Tests whether the resource named by this abstract pathname is a system resource.
 boolean isWriteable()
          Tests whether the application can modify the resource denoted by this abstract pathname.
 long lastModified()
          Returns the time that the resource denoted by this abstract pathname was last modified.
 long length()
          Returns the length of the resource denoted by this abstract pathname.
 String[] list()
          Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname.
 String[] list(FilenameFilter filter)
           
 String[] list(ResourceFilter filter)
           
 String[] list(ResourceNameFilter filter)
          Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter.
 File[] listFiles()
           
 File[] listFiles(FileFilter filter)
           
 File[] listFiles(FilenameFilter filter)
           
 Resource[] listResources()
          Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname.
 Resource[] listResources(ResourceFilter filter)
          Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter.
 Resource[] listResources(ResourceNameFilter filter)
          Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter.
 boolean mkdir()
          Creates the directory named by this abstract pathname.
 boolean mkdirs()
          Creates the directory named by this abstract pathname, including any necessary but nonexistent parent directories.
 void moveTo(Resource dest)
          Move/renames the file denoted by this abstract pathname.
 void remove(boolean force)
          Deletes the resource denoted by this abstract pathname.
 boolean renameTo(File dest)
           
 boolean renameTo(Resource dest)
          Move/renames the file denoted by this abstract pathname.
 void setArchive(boolean value)
          sets archive attribute of the resource
 void setAttribute(short attribute, boolean value)
          sets a attribute on the resource if supported otherwise it will ign
 void setHidden(boolean value)
          sets hidden attribute of the resource
 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 setReadOnly()
          Marks the file or directory named by this abstract pathname so that only read operations are allowed.
 void setSystem(boolean value)
          sets system attribute of the resource
 boolean setWritable(boolean value)
           
static File toFile(Resource res)
           
 String toString()
           
 URI toURI()
           
 URL toURL()
           
 
Methods inherited from class java.io.File
canExecute, createTempFile, createTempFile, getFreeSpace, getTotalSpace, getUsableSpace, listRoots, setExecutable, setExecutable, setReadable, setWritable
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

canRead

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

Specified by:
canRead in interface Resource
Overrides:
canRead in class File
Returns:
true if and only if the resource specified by this abstract pathname exists and can be read by the application; false otherwise
See Also:
File.canRead()

canWrite

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

Specified by:
canWrite in interface Resource
Overrides:
canWrite in class File
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:
File.canWrite()

compareTo

public int compareTo(File pathname)
Specified by:
compareTo in interface Comparable<File>
Overrides:
compareTo in class File
See Also:
File.compareTo(java.io.File)

createNewFile

public boolean createNewFile()
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.

Specified by:
createNewFile in interface Resource
Overrides:
createNewFile in class File
Returns:
true if the named file does not exist and was successfully created; false if the named file already exists
See Also:
File.createNewFile()

delete

public boolean delete()
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 oif the directory will be deleted.

Specified by:
delete in interface Resource
Overrides:
delete in class File
See Also:
File.delete()

deleteOnExit

public void deleteOnExit()
Overrides:
deleteOnExit in class File
See Also:
File.deleteOnExit()

equals

public boolean equals(Object obj)
Overrides:
equals in class File
See Also:
File.equals(java.lang.Object)

exists

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

Specified by:
exists in interface Resource
Overrides:
exists in class File
Returns:
true if and only if the resource denoted by this abstract pathname exists; false otherwise
See Also:
File.exists()

getAbsoluteFile

public File getAbsoluteFile()
Overrides:
getAbsoluteFile in class File
See Also:
File.getAbsoluteFile()

getAbsolutePath

public String getAbsolutePath()
Description copied from interface: Resource
Returns the absolute pathname string of this abstract pathname.

If this abstract pathname is already absolute, then the pathname string is simply returned as if by the Resource.getPath() method.

Specified by:
getAbsolutePath in interface Resource
Overrides:
getAbsolutePath in class File
Returns:
The absolute pathname string denoting the same resource as this abstract pathname
See Also:
File.getAbsolutePath()

getCanonicalFile

public File getCanonicalFile()
                      throws IOException
Overrides:
getCanonicalFile in class File
Throws:
IOException
See Also:
File.getCanonicalFile()

getCanonicalPath

public String getCanonicalPath()
                        throws IOException
Description copied from interface: Resource
Returns the canonical pathname string of this abstract pathname.

A canonical pathname is both absolute and unique. The precise definition of canonical form is system-dependent. This method first converts this pathname to absolute form if necessary, as if by invoking the Resource.getAbsolutePath() method, and then maps it to its unique form in a system-dependent way. This typically involves removing redundant names such as "." and ".." from the pathname.

Every pathname that denotes an existing file or directory has a unique canonical form. Every pathname that denotes a nonexistent resource also has a unique canonical form. The canonical form of the pathname of a nonexistent file or directory may be different from the canonical form of the same pathname after the resource is created. Similarly, the canonical form of the pathname of an existing resource may be different from the canonical form of the same pathname after the resource is deleted.

Specified by:
getCanonicalPath in interface Resource
Overrides:
getCanonicalPath in class File
Returns:
The canonical pathname string denoting the same file or directory as this abstract pathname
Throws:
IOException - If an I/O error occurs, which is possible because the construction of the canonical pathname may require filesystem queries
See Also:
File.getCanonicalPath()

getName

public String getName()
Description copied from interface: Resource
Returns the name of the resource denoted by this abstract pathname. This is just the last name in the pathname's name sequence. If the pathname's name sequence is empty, then the empty string is returned.

Specified by:
getName in interface Resource
Overrides:
getName in class File
Returns:
The name of the resource denoted by this abstract pathname, or the empty string if this pathname's name sequence is empty
See Also:
File.getName()

getParent

public String getParent()
Description copied from interface: Resource
Returns the pathname string of this abstract pathname's parent, or null if this pathname does not name a parent directory.

The parent of an abstract pathname consists of the pathname's prefix, if any, and each name in the pathname's name sequence except for the last. If the name sequence is empty then the pathname does not name a parent directory.

Specified by:
getParent in interface Resource
Overrides:
getParent in class File
Returns:
The pathname string of the parent directory named by this abstract pathname, or null if this pathname does not name a parent
See Also:
File.getParent()

getParentFile

public File getParentFile()
Overrides:
getParentFile in class File
See Also:
File.getParentFile()

getPath

public String getPath()
Description copied from interface: Resource
Converts this abstract pathname into a pathname string.

Specified by:
getPath in interface Resource
Overrides:
getPath in class File
Returns:
The string form of this abstract pathname
See Also:
File.getPath()

hashCode

public int hashCode()
Overrides:
hashCode in class File
See Also:
File.hashCode()

isAbsolute

public boolean isAbsolute()
Description copied from interface: Resource
Tests whether this abstract pathname is absolute.

Specified by:
isAbsolute in interface Resource
Overrides:
isAbsolute in class File
Returns:
true if this abstract pathname is absolute, false otherwise
See Also:
File.isAbsolute()

isDirectory

public boolean isDirectory()
Description copied from interface: Resource
Tests whether the resource denoted by this abstract pathname is a directory.

Specified by:
isDirectory in interface Resource
Overrides:
isDirectory in class File
Returns:
true if and only if the file denoted by this abstract pathname exists and is a directory; false otherwise
See Also:
File.isDirectory()

isFile

public boolean isFile()
Description copied from interface: Resource
Tests whether the file denoted by this abstract pathname is a normal file. A file is normal if it is not a directory and, in addition, satisfies other system-dependent criteria. Any non-directory file created by a Java application is guaranteed to be a normal file.

Specified by:
isFile in interface Resource
Overrides:
isFile in class File
Returns:
true if and only if the file denoted by this abstract pathname exists and is a normal file; false otherwise
See Also:
File.isFile()

isHidden

public boolean isHidden()
Description copied from interface: Resource
Tests whether the resource named by this abstract pathname is a hidden resource.

Specified by:
isHidden in interface Resource
Overrides:
isHidden in class File
Returns:
true if and only if the file denoted by this abstract pathname is hidden
See Also:
File.isHidden()

lastModified

public long lastModified()
Description copied from interface: Resource
Returns the time that the resource denoted by this abstract pathname was last modified.

Specified by:
lastModified in interface Resource
Overrides:
lastModified in class File
Returns:
A long value representing the time the file was last modified, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or 0L if the file does not exist or if an I/O error occurs
See Also:
File.lastModified()

length

public long length()
Description copied from interface: Resource
Returns the length of the resource denoted by this abstract pathname. The return value is unspecified if this pathname denotes a directory.

Specified by:
length in interface Resource
Overrides:
length in class File
Returns:
The length, in bytes, of the resource denoted by this abstract pathname, or 0L if the resource does not exist
See Also:
File.length()

list

public String[] list()
Description copied from interface: Resource
Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname.

If this abstract pathname does not denote a directory, then this method returns null. Otherwise an array of strings is returned, one for each file or directory in the directory. Names denoting the directory itself and the directory's parent directory are not included in the result. Each string is a file name rather than a complete path.

There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order.

Specified by:
list in interface Resource
Overrides:
list in class File
Returns:
An array of strings naming the files and directories in the directory denoted by this abstract pathname. The array will be empty if the directory is empty. Returns null if this abstract pathname does not denote a directory, or if an I/O error occurs.
See Also:
File.list()

list

public String[] list(FilenameFilter filter)
Overrides:
list in class File
See Also:
File.list(java.io.FilenameFilter)

listFiles

public File[] listFiles()
Overrides:
listFiles in class File
See Also:
File.listFiles()

listFiles

public File[] listFiles(FileFilter filter)
Overrides:
listFiles in class File
See Also:
File.listFiles(java.io.FileFilter)

listFiles

public File[] listFiles(FilenameFilter filter)
Overrides:
listFiles in class File
See Also:
File.listFiles(java.io.FilenameFilter)

mkdir

public boolean mkdir()
Description copied from interface: Resource
Creates the directory named by this abstract pathname.

Specified by:
mkdir in interface Resource
Overrides:
mkdir in class File
Returns:
true if and only if the directory was created; false otherwise
See Also:
File.mkdir()

mkdirs

public boolean mkdirs()
Description copied from interface: Resource
Creates the directory named by this abstract pathname, including any necessary but nonexistent parent directories. Note that if this operation fails it may have succeeded in creating some of the necessary parent directories.

Specified by:
mkdirs in interface Resource
Overrides:
mkdirs in class File
Returns:
true if and only if the directory was created, along with all necessary parent directories; false otherwise
See Also:
File.mkdirs()

renameTo

public boolean renameTo(File dest)
Overrides:
renameTo in class File
Throws:
IOException
See Also:
File.renameTo(java.io.File)

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.

Specified by:
setLastModified in interface Resource
Overrides:
setLastModified in class File
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:
File.setLastModified(long)

setReadOnly

public boolean setReadOnly()
Description copied from interface: Resource
Marks the file or directory named by this abstract pathname so that only read operations are allowed. After invoking this method the file or directory is guaranteed not to change until it is either deleted or marked to allow write access. Whether or not a read-only file or directory may be deleted depends upon the underlying system.

Specified by:
setReadOnly in interface Resource
Overrides:
setReadOnly in class File
Returns:
true if and only if the operation succeeded; false otherwise
See Also:
File.setReadOnly()

toString

public String toString()
Overrides:
toString in class File
See Also:
File.toString()

toURI

public URI toURI()
Overrides:
toURI in class File
See Also:
File.toURI()

toURL

public URL toURL()
          throws MalformedURLException
Overrides:
toURL in class File
Throws:
MalformedURLException
See Also:
File.toURL()

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.

Specified by:
createDirectory in interface Resource
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.

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

getAbsoluteResource

public Resource getAbsoluteResource()
Description copied from interface: Resource
Returns the absolute form of this abstract pathname.

Specified by:
getAbsoluteResource in interface Resource
Returns:
The absolute abstract pathname denoting the same resource as this abstract pathname
See Also:
Resource.getAbsoluteResource()

getCanonicalResource

public Resource getCanonicalResource()
                              throws IOException
Description copied from interface: Resource
Returns the canonical form of this abstract pathname.

Specified by:
getCanonicalResource in interface Resource
Returns:
The canonical pathname string denoting the same resource as this abstract pathname
Throws:
IOException - If an I/O error occurs, which is possible because the construction of the canonical pathname may require filesystem queries
See Also:
Resource.getCanonicalResource()

getInputStream

public InputStream getInputStream()
                           throws IOException
Specified by:
getInputStream in interface Resource
Throws:
IOException
See Also:
Resource.getInputStream()

getMode

public int getMode()
Specified by:
getMode in interface Resource
See Also:
Resource.getMode()

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
Specified by:
getOutputStream in interface Resource
Throws:
IOException
See Also:
Resource.getOutputStream()

getOutputStream

public OutputStream getOutputStream(boolean append)
                             throws IOException
Specified by:
getOutputStream in interface Resource
Throws:
IOException
See Also:
Resource.getOutputStream(boolean)

getParentResource

public Resource getParentResource()
Description copied from interface: Resource
Returns the abstract pathname of this abstract pathname's parent, or null if this pathname does not name a parent directory.

The parent of an abstract pathname consists of the pathname's prefix, if any, and each name in the pathname's name sequence except for the last. If the name sequence is empty then the pathname does not name a parent directory.

Specified by:
getParentResource in interface Resource
Returns:
The abstract pathname of the parent directory named by this abstract pathname, or null if this pathname does not name a parent
See Also:
Resource.getParentResource()

getReal

public String getReal(String realpath)
Description copied from interface: Resource
returns a resource path that is relative to the current resource

Specified by:
getReal in interface Resource
Returns:
relative resource path to the current
See Also:
Resource.getReal(java.lang.String)

getRealResource

public Resource getRealResource(String realpath)
Description copied from interface: Resource
returns a resource that is relative to the current resource

Specified by:
getRealResource in interface Resource
Returns:
relative resource to the current
See Also:
Resource.getRealResource(java.lang.String)

getResourceProvider

public ResourceProvider getResourceProvider()
Specified by:
getResourceProvider in interface Resource
See Also:
Resource.getResourceProvider()

isArchive

public boolean isArchive()
Description copied from interface: Resource
Tests whether the resource named by this abstract pathname is a archive resource.

Specified by:
isArchive in interface Resource
Returns:
true if and only if the file denoted by this abstract pathname is a archive
See Also:
Resource.isArchive()

isReadable

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

Specified by:
isReadable in interface Resource
Returns:
true if and only if the resource specified by this abstract pathname exists and can be read by the application; false otherwise
See Also:
Resource.isReadable()

isSystem

public boolean isSystem()
Description copied from interface: Resource
Tests whether the resource named by this abstract pathname is a system resource.

Specified by:
isSystem in interface Resource
Returns:
true if and only if the file denoted by this abstract pathname is a system resource
See Also:
Resource.isSystem()

isWriteable

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

Specified by:
isWriteable in interface Resource
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()

list

public String[] list(ResourceNameFilter filter)
Description copied from interface: Resource
Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter. The behavior of this method is the same as that of the Resource.list() method, except that the strings in the returned array must satisfy the filter. If the given filter is null then all names are accepted. Otherwise, a name satisfies the filter if and only if the value true results when the ResourceNameFilter.accept(railo.commons.io.res.Resource, java.lang.String) method of the filter is invoked on this abstract pathname and the name of a file or directory in the directory that it denotes.

Specified by:
list in interface Resource
Parameters:
filter - A resourcename filter
Returns:
An array of strings naming the files and directories in the directory denoted by this abstract pathname that were accepted by the given filter. The array will be empty if the directory is empty or if no names were accepted by the filter. Returns null if this abstract pathname does not denote a directory, or if an I/O error occurs.
See Also:
Resource.list(railo.commons.io.res.filter.ResourceNameFilter)

list

public String[] list(ResourceFilter filter)
Specified by:
list in interface Resource
See Also:
Resource.list(railo.commons.io.res.filter.ResourceFilter)

listResources

public Resource[] listResources()
Description copied from interface: Resource
Returns an array of abstract pathnames denoting the files in the directory denoted by this abstract pathname.

If this abstract pathname does not denote a directory, then this method returns null. Otherwise an array of File objects is returned, one for each file or directory in the directory. Therefore if this pathname is absolute then each resulting pathname is absolute; if this pathname is relative then each resulting pathname will be relative to the same directory.

There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order.

Specified by:
listResources in interface Resource
Returns:
An array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname. The array will be empty if the directory is empty. Returns null if this abstract pathname does not denote a directory, or if an I/O error occurs.
See Also:
Resource.listResources()

listResources

public Resource[] listResources(ResourceFilter filter)
Description copied from interface: Resource
Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter. The behavior of this method is the same as that of the Resource.listResources() method, except that the pathnames in the returned array must satisfy the filter. If the given filter is null then all pathnames are accepted. Otherwise, a pathname satisfies the filter if and only if the value true results when the ResourceFilter.accept(Resource) method of the filter is invoked on the pathname.

Specified by:
listResources in interface Resource
Parameters:
filter - A resource filter
Returns:
An array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname. The array will be empty if the directory is empty. Returns null if this abstract pathname does not denote a directory, or if an I/O error occurs.
See Also:
Resource.listResources(railo.commons.io.res.filter.ResourceFilter)

listResources

public Resource[] listResources(ResourceNameFilter filter)
Description copied from interface: Resource
Returns an array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname that satisfy the specified filter. The behavior of this method is the same as that of the Resource.listResources() method, except that the pathnames in the returned array must satisfy the filter. If the given filter is null then all pathnames are accepted. Otherwise, a pathname satisfies the filter if and only if the value true results when the ResourceNameFilter.accept(railo.commons.io.res.Resource, java.lang.String) method of the filter is invoked on this abstract pathname and the name of a file or directory in the directory that it denotes.

Specified by:
listResources in interface Resource
Parameters:
filter - A resourcename filter
Returns:
An array of abstract pathnames denoting the files and directories in the directory denoted by this abstract pathname. The array will be empty if the directory is empty. Returns null if this abstract pathname does not denote a directory, or if an I/O error occurs.
See Also:
Resource.listResources(railo.commons.io.res.filter.ResourceNameFilter)

moveTo

public void moveTo(Resource dest)
            throws IOException
Description copied from interface: Resource
Move/renames the file denoted by this abstract pathname.

Many aspects of the behavior of this method are inherently platform-dependent: The rename operation might not be able to move a file from one filesystem to another, it might not be atomic, and it might not succeed if a file with the destination abstract pathname already exists.

Specified by:
moveTo in interface Resource
Parameters:
dest - The new abstract pathname for the named file
Throws:
IOException - throwed when operation not done sucessfull
See Also:
Resource.moveTo(railo.commons.io.res.Resource)

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.

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

renameTo

public boolean renameTo(Resource dest)
Description copied from interface: Resource
Move/renames the file denoted by this abstract pathname.

Many aspects of the behavior of this method are inherently platform-dependent: The rename operation might not be able to move a file from one filesystem to another, it might not be atomic, and it might not succeed if a file with the destination abstract pathname already exists.

Specified by:
renameTo in interface Resource
Parameters:
dest - The new abstract pathname for the named file
Returns:
has successfull renamed or not
See Also:
Resource.renameTo(railo.commons.io.res.Resource)

setMode

public void setMode(int mode)
             throws IOException
Specified by:
setMode in interface Resource
Throws:
IOException
See Also:
Resource.setMode(int)

toFile

public static File toFile(Resource res)
Parameters:
res -
Returns:

setArchive

public void setArchive(boolean value)
                throws IOException
Description copied from interface: Resource
sets archive attribute of the resource

Specified by:
setArchive in interface Resource
Throws:
IOException - throwed when no access to change the value or the resource doesn't exists
See Also:
Resource.setArchive(boolean)

setHidden

public void setHidden(boolean value)
               throws IOException
Description copied from interface: Resource
sets hidden attribute of the resource

Specified by:
setHidden in interface Resource
Throws:
IOException - throwed when no access to change the value or the resource doesn't exists
See Also:
Resource.setHidden(boolean)

setSystem

public void setSystem(boolean value)
               throws IOException
Description copied from interface: Resource
sets system attribute of the resource

Specified by:
setSystem in interface Resource
Throws:
IOException - throwed when no access to change the value or the resource doesn't exists
See Also:
Resource.setSystem(boolean)

getAttribute

public boolean getAttribute(short attribute)
Description copied from interface: Resource
return value of a specific attribute

Specified by:
getAttribute in interface Resource
Returns:
value of the attribute
See Also:
Resource.getAttribute(short)

setAttribute

public void setAttribute(short attribute,
                         boolean value)
                  throws IOException
Description copied from interface: Resource
sets a attribute on the resource if supported otherwise it will ign

Specified by:
setAttribute in interface Resource
Parameters:
attribute - wich attrbute (Resource.ATTRIBUTE_*)
Throws:
IOException - throwed when no access to change the value, when attributes are not supported or the resource doesn't exists
See Also:
Resource.setAttribute(short, boolean)

setReadable

public boolean setReadable(boolean value)
Specified by:
setReadable in interface Resource
Overrides:
setReadable in class File
See Also:
Resource.setReadable(boolean)

setWritable

public boolean setWritable(boolean value)
Specified by:
setWritable in interface Resource
Overrides:
setWritable in class File
See Also:
Resource.setWritable(boolean)

copyFrom

public void copyFrom(Resource res,
                     boolean append)
              throws IOException
Description copied from interface: Resource
copy data of given resource to current

Specified by:
copyFrom in interface Resource
Throws:
IOException

copyTo

public void copyTo(Resource res,
                   boolean append)
            throws IOException
Description copied from interface: Resource
copy current resource data to given resource

Specified by:
copyTo in interface Resource
Throws:
IOException


Copyright © 2012 Railo