|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.mortbay.util.Resource
Abstract resource class.
Constructor Summary | |
Resource()
|
Method Summary | |
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. |
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)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Resource()
Method Detail |
public static Resource newResource(java.net.URL url) throws java.io.IOException
url
- A URL.
java.io.IOException
public static Resource newResource(java.lang.String resource) throws java.net.MalformedURLException, java.io.IOException
resource
- A URL or filename.
java.net.MalformedURLException
java.io.IOException
public static Resource newSystemResource(java.lang.String resource) throws java.io.IOException
java.io.IOException
public 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.IOException
public abstract java.lang.String getName()
public abstract java.io.InputStream getInputStream() throws java.io.IOException
java.io.IOException
public abstract java.io.OutputStream getOutputStream() throws java.io.IOException, java.lang.SecurityException
java.io.IOException
java.lang.SecurityException
public abstract boolean delete() throws java.lang.SecurityException
java.lang.SecurityException
public abstract boolean renameTo(Resource dest) throws java.lang.SecurityException
java.lang.SecurityException
public 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.IOException
java.net.MalformedURLException
public 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.IOException
public 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 included
java.io.IOException
public 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.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |