public abstract class Resource
extends java.lang.Object
implements java.io.Serializable
| Constructor and Description |
|---|
Resource() |
| Modifier and Type | Method and Description |
|---|---|
abstract Resource |
addPath(java.lang.String path)
Returns the resource contained inside the current resource with the
given name.
|
CachedResource |
cache() |
abstract boolean |
delete()
Deletes the given resource
|
java.lang.String |
encode(java.lang.String uri)
Encode according to this resource type.
|
abstract boolean |
exists()
Returns true if the respresened resource exists.
|
protected void |
finalize() |
java.net.URL |
getAlias() |
java.lang.Object |
getAssociate() |
abstract java.io.File |
getFile()
Returns an File representing the given resource or NULL if this
is not possible.
|
abstract java.io.InputStream |
getInputStream()
Returns an input stream to the resource
|
java.lang.String |
getListHTML(java.lang.String base,
boolean parent)
Get the resource list as a HTML directory listing.
|
abstract java.lang.String |
getName()
Returns the name of the resource
|
abstract java.io.OutputStream |
getOutputStream()
Returns an output stream to the resource
|
abstract java.net.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 java.lang.String[] |
list()
Returns a list of resource names contained in the given resource
The resource names are not URL encoded.
|
static Resource |
newResource(java.lang.String resource)
Construct a resource from a string.
|
static Resource |
newResource(java.net.URL url)
Construct a resource from a url.
|
static Resource |
newSystemResource(java.lang.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(java.lang.Object o) |
void |
writeTo(java.io.OutputStream out,
long start,
long count) |
public static Resource newResource(java.net.URL url) throws java.io.IOException
url - A URL.java.io.IOExceptionpublic static Resource newResource(java.lang.String resource) throws java.net.MalformedURLException, java.io.IOException
resource - A URL or filename.java.net.MalformedURLExceptionjava.io.IOExceptionpublic static Resource newSystemResource(java.lang.String resource) throws java.io.IOException
java.io.IOExceptionprotected void finalize()
finalize in class java.lang.Objectpublic abstract void release()
public abstract boolean exists()
public abstract boolean isDirectory()
public abstract long lastModified()
public abstract long length()
public abstract java.net.URL getURL()
public abstract java.io.File getFile()
throws java.io.IOException
java.io.IOExceptionpublic abstract java.lang.String getName()
public abstract java.io.InputStream getInputStream()
throws java.io.IOException
java.io.IOExceptionpublic abstract java.io.OutputStream getOutputStream()
throws java.io.IOException,
java.lang.SecurityException
java.io.IOExceptionjava.lang.SecurityExceptionpublic abstract boolean delete()
throws java.lang.SecurityException
java.lang.SecurityExceptionpublic abstract boolean renameTo(Resource dest) throws java.lang.SecurityException
java.lang.SecurityExceptionpublic abstract java.lang.String[] list()
public abstract Resource addPath(java.lang.String path) throws java.io.IOException, java.net.MalformedURLException
path - The path segment to add, which should be encoded by the
encode method.java.io.IOExceptionjava.net.MalformedURLExceptionpublic java.lang.String encode(java.lang.String uri)
uri - public java.lang.Object getAssociate()
public void setAssociate(java.lang.Object o)
public java.net.URL getAlias()
public CachedResource cache() throws java.io.IOException
java.io.IOExceptionpublic java.lang.String getListHTML(java.lang.String base,
boolean parent)
throws java.io.IOException
base - The base URLparent - True if the parent directory should be includedjava.io.IOExceptionpublic void writeTo(java.io.OutputStream out,
long start,
long count)
throws java.io.IOException
out - start - First byte to writecount - Bytes to write or -1 for all of them.java.io.IOExceptionCopyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.