org.mortbay.util
Class FileResource
- Serializable
public class FileResource
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.
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.
|
addPath , checkConnection , delete , equals , exists , getFile , getInputStream , getName , getOutputStream , getURL , hashCode , isDirectory , lastModified , length , list , release , renameTo , toString |
addPath , cache , delete , encode , exists , finalize , getAlias , getAssociate , getFile , getInputStream , getListHTML , getName , getOutputStream , getURL , isDirectory , lastModified , length , list , newResource , newResource , newSystemResource , release , renameTo , setAssociate , writeTo |
delete
public boolean delete()
throws SecurityException
Deletes the given resource
- delete in interface URLResource
encode
public String encode(String uri)
Encode according to this resource type.
File URIs are encoded.
- encode in interface Resource
exists
public boolean exists()
Returns true if the resource exists.
- exists in interface URLResource
getCheckAliases
public static boolean getCheckAliases()
getCheckAliases.
- True of resource aliases are to be checked for (eg case insensitivity or 8.3 short names) and treated as not found.
getFile
public File getFile()
Returns an File representing the given resource or NULL if this
is not possible.
- getFile in interface URLResource
getInputStream
public InputStream getInputStream()
throws IOException
Returns an input stream to the resource
- getInputStream in interface URLResource
getName
public String getName()
Returns the name of the resource
- getName in interface URLResource
getOutputStream
public OutputStream getOutputStream()
throws IOException,
SecurityException
Returns an output stream to the resource
- getOutputStream in interface URLResource
isDirectory
public boolean isDirectory()
Returns true if the respresenetd resource is a container/directory.
- isDirectory in interface URLResource
length
public long length()
Return the length of the resource
- length in interface URLResource
list
public String[] list()
Returns a list of resources contained in the given resource
- list in interface URLResource
setCheckAliases
public static void setCheckAliases(boolean checkAliases)
setCheckAliases.
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.