org.mortbay.util
Class FileResource
public
class
FileResource
extends URLResource
File Resource.
Handle resources of implied or explicit file type.
This class can check for aliasing in the filesystem (eg case
insensitivity). By default this is turned on if the platform does
not have the "/" path separator, or it can be controlled with the
"org.mortbay.util.FileResource.checkAliases" system parameter.
If alias checking is turned on, then aliased resources are
treated as if they do not exist, nor can they be created.
Version: $Revision: 1.31 $
Author: Greg Wilkins (gregw)
Method Summary |
Resource | addPath(String path) |
boolean | delete()
Deletes the given resource |
String | encode(String uri) Encode according to this resource type.
|
boolean | equals(Object o) |
boolean | exists()
Returns true if the resource exists. |
URL | getAlias() |
static boolean | getCheckAliases() getCheckAliases. |
File | getFile()
Returns an File representing the given resource or NULL if this
is not possible. |
InputStream | getInputStream()
Returns an input stream to the resource |
String | getName()
Returns the name of the resource |
OutputStream | getOutputStream()
Returns an output stream to the resource |
int | hashCode() |
boolean | isDirectory()
Returns true if the respresenetd resource is a container/directory. |
long | lastModified()
Returns the last modified time |
long | length()
Return the length of the resource |
String[] | list()
Returns a list of resources contained in the given resource |
boolean | renameTo(Resource dest)
Rename the given resource |
static void | setCheckAliases(boolean checkAliases) setCheckAliases. |
public boolean delete()
Deletes the given resource
public String encode(String uri)
Encode according to this resource type.
File URIs are encoded.
Parameters: uri URI to encode.
Returns: The uri unchanged.
public boolean equals(Object o)
public boolean exists()
Returns true if the resource exists.
public URL getAlias()
public static boolean getCheckAliases()
getCheckAliases.
Returns: True of resource aliases are to be checked for (eg case insensitivity or 8.3 short names) and treated as not found.
public File getFile()
Returns an File representing the given resource or NULL if this
is not possible.
public InputStream getInputStream()
Returns an input stream to the resource
public String getName()
Returns the name of the resource
public OutputStream getOutputStream()
Returns an output stream to the resource
public int hashCode()
public boolean isDirectory()
Returns true if the respresenetd resource is a container/directory.
public long lastModified()
Returns the last modified time
public long length()
Return the length of the resource
public String[] list()
Returns a list of resources contained in the given resource
Rename the given resource
public static void setCheckAliases(boolean checkAliases)
setCheckAliases.
Parameters: checkAliases True of resource aliases are to be checked for (eg case insensitivity or 8.3 short names) and treated as not found.
Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.