public class ResourceCollection extends Resource
__defaultUseCaches
Constructor and Description |
---|
ResourceCollection()
Instantiates an empty resource collection.
|
ResourceCollection(Resource... resources)
Instantiates a new resource collection.
|
ResourceCollection(java.lang.String csvResources)
Instantiates a new resource collection.
|
ResourceCollection(java.lang.String[] resources)
Instantiates a new resource collection.
|
Modifier and Type | Method and Description |
---|---|
Resource |
addPath(java.lang.String path)
Returns the resource contained inside the current resource with the
given name.
|
void |
close()
Release any temporary resources held by the resource.
|
void |
copyTo(java.io.File destination)
Copy the Resource to the new destination file.
|
boolean |
delete()
Deletes the given resource
|
boolean |
exists() |
java.io.File |
getFile()
File representing the given resource.
|
java.io.InputStream |
getInputStream()
Input stream to the resource
|
java.lang.String |
getName()
The name of the resource.
|
java.nio.channels.ReadableByteChannel |
getReadableByteChannel()
Readable ByteChannel for the resource.
|
Resource[] |
getResources()
Retrieves the resource collection's resources.
|
java.net.URL |
getURL()
URL representing the resource.
|
boolean |
isContainedIn(Resource r) |
boolean |
isDirectory() |
long |
lastModified()
Time resource was last modified.
|
long |
length()
Length of the resource.
|
java.lang.String[] |
list()
list of resource names contained in the given resource.
|
boolean |
renameTo(Resource dest)
Rename the given resource
|
void |
setResources(Resource[] resources)
Sets the resource collection's resources.
|
void |
setResourcesAsCSV(java.lang.String csvResources)
Sets the resources as string of comma-separated values.
|
java.lang.String |
toString() |
encode, finalize, getAlias, getAllResources, getAssociate, getDefaultUseCaches, getListHTML, getResource, getURI, getWeakETag, getWeakETag, isAlias, isContainedIn, newClassPathResource, newClassPathResource, newResource, newResource, newResource, newResource, newResource, newResource, newSystemResource, release, setAssociate, setDefaultUseCaches, toURL, writeTo
public ResourceCollection()
This constructor is used when configuring jetty-maven-plugin.
public ResourceCollection(Resource... resources)
resources
- the resources to be added to collectionpublic ResourceCollection(java.lang.String[] resources)
resources
- the resource strings to be added to collectionpublic ResourceCollection(java.lang.String csvResources)
csvResources
- the string containing comma-separated resource stringspublic Resource[] getResources()
public void setResources(Resource[] resources)
resources
- the new resource arraypublic void setResourcesAsCSV(java.lang.String csvResources)
csvResources
- the comma-separated string containing
one or more resource strings.public Resource addPath(java.lang.String path) throws java.io.IOException
Resource
addPath
in class Resource
path
- The path segment to addjava.io.IOException
- if unable to resolve the pathjava.net.MalformedURLException
- if the resolution of the path fails because the input path parameter is malformed.public boolean delete() throws java.lang.SecurityException
Resource
public boolean exists()
public java.io.File getFile() throws java.io.IOException
Resource
public java.io.InputStream getInputStream() throws java.io.IOException
Resource
getInputStream
in class Resource
java.io.IOException
- if unable to open the input streampublic java.nio.channels.ReadableByteChannel getReadableByteChannel() throws java.io.IOException
Resource
getReadableByteChannel
in class Resource
java.io.IOException
- if unable to open the readable bytechannel for the resource.public java.lang.String getName()
Resource
public java.net.URL getURL()
Resource
public boolean isDirectory()
isDirectory
in class Resource
public long lastModified()
Resource
lastModified
in class Resource
public long length()
Resource
public java.lang.String[] list()
Resource
public void close()
Resource
public boolean renameTo(Resource dest) throws java.lang.SecurityException
Resource
public void copyTo(java.io.File destination) throws java.io.IOException
Resource
Will not replace existing destination file.
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isContainedIn(Resource r)
isContainedIn
in class Resource
Copyright © 1995–2023 Webtide. All rights reserved.