railo.commons.io.res.type.compress
Class CompressResource

java.lang.Object
  extended by railo.commons.io.res.util.ResourceSupport
      extended by railo.commons.io.res.type.compress.CompressResource
All Implemented Interfaces:
Serializable, Resource

public final class CompressResource
extends ResourceSupport

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface railo.commons.io.res.Resource
ATTRIBUTE_ARCHIVE, ATTRIBUTE_HIDDEN, ATTRIBUTE_SYSTEM
 
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.
 boolean exists()
          Tests whether the resource denoted by this abstract pathname exists.
 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.
 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.
 Resource getRealResource(String realpath)
          returns a resource that is relative to the current resource
 ResourceProvider getResourceProvider()
           
 boolean isAbsolute()
          Tests whether this abstract pathname is absolute.
 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 isReadable()
          Tests whether the application can read the resource denoted by this abstract pathname.
 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.
 Resource[] listResources()
          Returns an array of abstract pathnames denoting the files in the directory 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, getReal, isArchive, isHidden, isSystem, 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
 

Method Detail

exists

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

Returns:
true if and only if the resource denoted by this abstract pathname exists; false otherwise
See Also:
Resource.exists()

getInputStream

public InputStream getInputStream()
                           throws IOException
Throws:
IOException
See Also:
Resource.getInputStream()

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.

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:
Resource.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.

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:
Resource.getParent()

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.

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()

getPath

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

Returns:
The string form of this abstract pathname
See Also:
Resource.getPath()

getRealResource

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

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

getResourceProvider

public ResourceProvider getResourceProvider()
See Also:
Resource.getResourceProvider()

isAbsolute

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

Returns:
true if this abstract pathname is absolute, false otherwise
See Also:
Resource.isAbsolute()

isDirectory

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

Returns:
true if and only if the file denoted by this abstract pathname exists and is a directory; false otherwise
See Also:
Resource.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.

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

isReadable

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

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()

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()

lastModified

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

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:
Resource.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.

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

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.

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()

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 ResourceSupport
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:
ResourceSupport.list()

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)

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)

getOutputStream

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

getOutputStream

public OutputStream getOutputStream(boolean append)
                             throws IOException
Throws:
IOException
See Also:
Resource.getOutputStream(boolean)

getMode

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

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)


Copyright © 2012 Railo