org.mortbay.util
public abstract class Resource extends Object implements Serializable
Version: $Id: Resource.java,v 1.31 2005/10/21 11:36:56 gregwilkins Exp $
Method Summary | |
---|---|
abstract Resource | addPath(String path)
Returns the resource contained inside the current resource with the
given name. |
CachedResource | cache() |
abstract boolean | delete()
Deletes the given resource |
String | encode(String uri) Encode according to this resource type.
|
abstract boolean | exists()
Returns true if the respresened resource exists. |
protected void | finalize() |
URL | getAlias() |
Object | getAssociate() |
abstract File | getFile()
Returns an File representing the given resource or NULL if this
is not possible. |
abstract InputStream | getInputStream()
Returns an input stream to the resource |
String | getListHTML(String base, boolean parent) Get the resource list as a HTML directory listing. |
abstract String | getName()
Returns the name of the resource |
abstract OutputStream | getOutputStream()
Returns an output stream to the resource |
abstract URL | getURL()
Returns an URL representing the given resource |
abstract boolean | isDirectory()
Returns true if the respresenetd resource is a container/directory.
|
abstract long | lastModified()
Returns the last modified time |
abstract long | length()
Return the length of the resource |
abstract String[] | list()
Returns a list of resource names contained in the given resource
The resource names are not URL encoded. |
static Resource | newResource(URL url) Construct a resource from a url. |
static Resource | newResource(String resource) Construct a resource from a string. |
static Resource | newSystemResource(String resource) Construct a system resource from a string.
|
abstract void | release() Release any resources held by the resource. |
abstract boolean | renameTo(Resource dest)
Rename the given resource |
void | setAssociate(Object o) |
void | writeTo(OutputStream out, long start, long count) |
Parameters: path The path segment to add, which should be encoded by the encode method.
Parameters: uri
Returns: String encoded for this resource type.
Returns: The canonical Alias of this resource or null if none.
Parameters: base The base URL parent True if the parent directory should be included
Returns: String of HTML
Parameters: url A URL.
Returns: A Resource object.
Parameters: resource A URL or filename.
Returns: A Resource object.
Parameters: out start First byte to write count Bytes to write or -1 for all of them.