|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
a Resource handle connection to different resources in a abstract form
| Field Summary | |
static short |
ATTRIBUTE_ARCHIVE
|
static short |
ATTRIBUTE_HIDDEN
|
static short |
ATTRIBUTE_SYSTEM
|
| Method Summary | |
boolean |
canRead()
Deprecated. use instead #isReadable() |
boolean |
canWrite()
Deprecated. use instead #isWriteable() |
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()
Deprecated. use instead #createFile(boolean) |
boolean |
delete()
Deprecated. replaced with method remove(boolean) |
boolean |
exists()
Tests whether the resource denoted by this abstract pathname exists. |
java.lang.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 |
java.lang.String |
getCanonicalPath()
Returns the canonical pathname string of this abstract pathname. |
Resource |
getCanonicalResource()
Returns the canonical form of this abstract pathname. |
java.io.InputStream |
getInputStream()
|
int |
getMode()
|
java.lang.String |
getName()
Returns the name of the resource denoted by this abstract pathname. |
java.io.OutputStream |
getOutputStream()
|
java.io.OutputStream |
getOutputStream(boolean append)
|
java.lang.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.
|
java.lang.String |
getPath()
Converts this abstract pathname into a pathname string. |
java.lang.String |
getReal(java.lang.String realpath)
returns a resource path that is relative to the current resource |
Resource |
getRealResource(java.lang.String realpath)
returns a resource that is relative to the current resource |
ResourceProvider |
getResourceProvider()
|
boolean |
isAbsolute()
Tests whether this abstract pathname is absolute. |
boolean |
isArchive()
Deprecated. use instead |
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()
Deprecated. use instead |
boolean |
isReadable()
Tests whether the application can read the resource denoted by this abstract pathname. |
boolean |
isSystem()
Deprecated. use instead |
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. |
java.lang.String[] |
list()
Returns an array of strings naming the files and directories in the directory denoted by this abstract pathname. |
java.lang.String[] |
list(ResourceFilter filter)
|
java.lang.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. |
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()
Deprecated. use #createDirectory(boolean) |
boolean |
mkdirs()
Deprecated. use #createDirectory(boolean) |
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(Resource dest)
Deprecated. use instead #moveTo(Resource) |
void |
setArchive(boolean value)
Deprecated. use instead |
void |
setAttribute(short attribute,
boolean value)
sets a attribute on the resource if supported otherwise it will ign |
void |
setHidden(boolean value)
Deprecated. use instead |
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 readable)
|
boolean |
setReadOnly()
Deprecated. use instead |
void |
setSystem(boolean value)
Deprecated. use instead |
boolean |
setWritable(boolean writable)
|
| Field Detail |
public static final short ATTRIBUTE_HIDDEN
public static final short ATTRIBUTE_SYSTEM
public static final short ATTRIBUTE_ARCHIVE
| Method Detail |
public boolean isReadable()
true if and only if the resource specified by this
abstract pathname exists and can be read by the
application; false otherwisepublic boolean canRead()
#isReadable()
true if and only if the resource specified by this
abstract pathname exists and can be read by the
application; false otherwisepublic boolean isWriteable()
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 boolean canWrite()
#isWriteable()
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 java.io.IOException
force -
java.io.IOException - if the file doesn't exists or can't deletepublic boolean delete()
java.io.IOException - if the file doesn't exists or can't deletepublic boolean exists()
true if and only if the resource denoted
by this abstract pathname exists; false otherwisepublic Resource getAbsoluteResource()
public java.lang.String getAbsolutePath()
If this abstract pathname is already absolute, then the pathname
string is simply returned as if by the
method.
getPath()
public Resource getCanonicalResource()
throws java.io.IOException
java.io.IOException - If an I/O error occurs, which is possible because the
construction of the canonical pathname may require
filesystem queries
public java.lang.String getCanonicalPath()
throws java.io.IOException
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
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.
java.io.IOException - If an I/O error occurs, which is possible because the
construction of the canonical pathname may require
filesystem queriespublic java.lang.String getName()
public java.lang.String getParent()
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.
null if this pathname
does not name a parentpublic Resource getParentResource()
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.
null if this pathname
does not name a parentpublic java.lang.String getReal(java.lang.String realpath)
realpath -
public Resource getRealResource(java.lang.String realpath)
realpath -
public java.lang.String getPath()
public boolean isAbsolute()
true if this abstract pathname is absolute,
false otherwisepublic boolean isDirectory()
true if and only if the file denoted by this
abstract pathname exists and is a directory;
false otherwisepublic boolean isFile()
true if and only if the file denoted by this
abstract pathname exists and is a normal file;
false otherwisepublic boolean isHidden()
getAttribute(short)
true if and only if the file denoted by this
abstract pathname is hiddenpublic boolean isArchive()
getAttribute(short)
true if and only if the file denoted by this
abstract pathname is a archivepublic boolean isSystem()
getAttribute(short)
true if and only if the file denoted by this
abstract pathname is a system resourcepublic long lastModified()
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 occurspublic long length()
0L if the resource does not existpublic java.lang.String[] list()
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.
null if
this abstract pathname does not denote a directory, or if an
I/O error occurs.public java.lang.String[] list(ResourceNameFilter filter)
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.
filter - A resourcename filter
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.public java.lang.String[] list(ResourceFilter filter)
public Resource[] listResources()
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.
null if this abstract pathname
does not denote a directory, or if an I/O error occurs.public Resource[] listResources(ResourceFilter filter)
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.
filter - A resource filter
null if this abstract pathname
does not denote a directory, or if an I/O error occurs.public Resource[] listResources(ResourceNameFilter filter)
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.
filter - A resourcename filter
null if this abstract pathname
does not denote a directory, or if an I/O error occurs.public boolean renameTo(Resource dest)
#moveTo(Resource)
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.
dest - The new abstract pathname for the named file
public void moveTo(Resource dest)
throws java.io.IOException
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.
dest - The new abstract pathname for the named file
java.io.IOException - throwed when operation not done sucessfullpublic boolean setLastModified(long time)
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) 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 boolean setReadOnly()
setWritable(boolean)
true if and only if the operation succeeded;
false otherwisepublic boolean setWritable(boolean writable)
public boolean setReadable(boolean readable)
public boolean createNewFile()
#createFile(boolean)
true if the named file does not exist and was
successfully created; false if the named file
already exists
java.io.IOException - If an I/O error occurred
public void createFile(boolean createParentWhenNotExists)
throws java.io.IOException
createParentWhenNotExists -
java.io.IOException - If an I/O error occurredpublic boolean mkdir()
#createDirectory(boolean)
true if and only if the directory was
created; false otherwisepublic boolean mkdirs()
#createDirectory(boolean)
true if and only if the directory was created,
along with all necessary parent directories; false
otherwise
public void createDirectory(boolean createParentWhenNotExists)
throws java.io.IOException
createParentWhenNotExists - throws Exception when can't create directory
java.io.IOException
public java.io.InputStream getInputStream()
throws java.io.IOException
java.io.IOException
public java.io.OutputStream getOutputStream()
throws java.io.IOException
java.io.IOException
public void copyTo(Resource res,
boolean append)
throws java.io.IOException
res -
java.io.IOException
public void copyFrom(Resource res,
boolean append)
throws java.io.IOException
res -
java.io.IOException
public java.io.OutputStream getOutputStream(boolean append)
throws java.io.IOException
java.io.IOExceptionpublic ResourceProvider getResourceProvider()
public int getMode()
public void setMode(int mode)
throws java.io.IOException
java.io.IOException
public void setHidden(boolean value)
throws java.io.IOException
setAttribute(short, boolean)
value -
java.io.IOException - throwed when no access to change the value or the resource doesn't exists
public void setSystem(boolean value)
throws java.io.IOException
setAttribute(short, boolean)
value -
java.io.IOException - throwed when no access to change the value or the resource doesn't exists
public void setArchive(boolean value)
throws java.io.IOException
setAttribute(short, boolean)
value -
java.io.IOException - throwed when no access to change the value or the resource doesn't exists
public void setAttribute(short attribute,
boolean value)
throws java.io.IOException
attribute - wich attrbute (Resource.ATTRIBUTE_*)value -
java.io.IOException - throwed when no access to change the value,
when attributes are not supported or
the resource doesn't existspublic boolean getAttribute(short attribute)
attribute -
java.io.IOException - throwed when attributes are not supported or
the resource doesn't exists
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||