|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.jetty.util.resource.Resource
public abstract class Resource
Abstract resource class.
Field Summary | |
---|---|
static boolean |
__defaultUseCaches
|
Constructor Summary | |
---|---|
Resource()
|
Method Summary | |
---|---|
abstract Resource |
addPath(java.lang.String path)
Returns the resource contained inside the current resource with the given name. |
void |
copyTo(java.io.File destination)
|
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()
|
static boolean |
getDefaultUseCaches()
|
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 |
Resource |
getResource(java.lang.String path)
Get a resource from withing this resource. |
java.net.URI |
getURI()
Returns an URI representing the given resource |
abstract java.net.URL |
getURL()
Returns an URL representing the given resource |
abstract boolean |
isContainedIn(Resource r)
|
static boolean |
isContainedIn(Resource r,
Resource containingResource)
|
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 |
newClassPathResource(java.lang.String resource)
Find a classpath resource. |
static Resource |
newClassPathResource(java.lang.String name,
boolean useCaches,
boolean checkParents)
Find a classpath resource. |
static Resource |
newResource(java.lang.String resource)
Construct a resource from a string. |
static Resource |
newResource(java.lang.String resource,
boolean useCaches)
Construct a resource from a string. |
static Resource |
newResource(java.net.URI uri)
Construct a resource from a uri. |
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 temporary resources held by the resource. |
abstract boolean |
renameTo(Resource dest)
Rename the given resource |
void |
setAssociate(java.lang.Object o)
|
static void |
setDefaultUseCaches(boolean useCaches)
Change the default setting for url connection caches. |
void |
writeTo(java.io.OutputStream out,
long start,
long count)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static boolean __defaultUseCaches
Constructor Detail |
---|
public Resource()
Method Detail |
---|
public static void setDefaultUseCaches(boolean useCaches)
useCaches
- public static boolean getDefaultUseCaches()
public static Resource newResource(java.net.URI uri) throws java.io.IOException
uri
- A URI.
java.io.IOException
- Problem accessing URIpublic static Resource newResource(java.net.URL url) throws java.io.IOException
url
- A URL.
java.io.IOException
- Problem accessing URLpublic 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 newResource(java.lang.String resource, boolean useCaches) throws java.net.MalformedURLException, java.io.IOException
resource
- A URL or filename.useCaches
- controls URLConnection caching
java.net.MalformedURLException
java.io.IOException
public static Resource newSystemResource(java.lang.String resource) throws java.io.IOException
resource
- Resource as string representation
java.io.IOException
- Problem accessing resource.public static Resource newClassPathResource(java.lang.String resource)
public static Resource newClassPathResource(java.lang.String name, boolean useCaches, boolean checkParents)
Class.getResource(String)
method is used to lookup the resource. If it is not
found, then the Loader.getResource(Class, String, boolean)
method is used.
If it is still not found, then ClassLoader.getSystemResource(String)
is used.
Unlike ClassLoader.getSystemResource(String)
this method does not check for normal resources.
name
- The relative name of the resourceuseCaches
- True if URL caches are to be used.checkParents
- True if forced searching of parent Classloaders is performed to work around
loaders with inverted priorities
public static boolean isContainedIn(Resource r, Resource containingResource) throws java.net.MalformedURLException
java.net.MalformedURLException
protected void finalize()
finalize
in class java.lang.Object
public abstract boolean isContainedIn(Resource r) throws java.net.MalformedURLException
java.net.MalformedURLException
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 java.net.URI getURI()
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 Resource getResource(java.lang.String path)
This method is essentially an alias for addPath(String)
, but without checked exceptions.
This method satisfied the ResourceFactory
interface.
getResource
in interface ResourceFactory
path
- The path to the resource
ResourceFactory.getResource(java.lang.String)
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 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
public void copyTo(java.io.File destination) throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |