public class ResourceCollection extends Resource
__defaultUseCaches| Constructor and Description |
|---|
ResourceCollection()
Instantiates an empty resource collection.
|
ResourceCollection(Resource... resources)
Instantiates a new resource collection.
|
ResourceCollection(String csvResources)
Instantiates a new resource collection.
|
ResourceCollection(String[] resources)
Instantiates a new resource collection.
|
| Modifier and Type | Method and Description |
|---|---|
Resource |
addPath(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(File destination)
Copy the Resource to the new destination file.
|
boolean |
delete()
Deletes the given resource
|
boolean |
exists() |
protected Object |
findResource(String path) |
File |
getFile()
File representing the given resource.
|
InputStream |
getInputStream()
Input stream to the resource
|
String |
getName()
The name of the resource.
|
ReadableByteChannel |
getReadableByteChannel()
Readable ByteChannel for the resource.
|
Resource[] |
getResources()
Retrieves the resource collection's resources.
|
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.
|
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(String csvResources)
Sets the resources as string of comma-separated values.
|
String |
toString() |
encode, finalize, getAlias, getAllResources, getAssociate, getDefaultUseCaches, getListHTML, getResource, getURI, getWeakETag, getWeakETag, isAlias, isContainedIn, newClassPathResource, newClassPathResource, newResource, newResource, newResource, newResource, newResource, newSystemResource, release, setAssociate, setDefaultUseCaches, toURL, writeTopublic ResourceCollection()
public ResourceCollection(Resource... resources)
resources - the resources to be added to collectionpublic ResourceCollection(String[] resources)
resources - the resource strings to be added to collectionpublic ResourceCollection(String csvResources)
csvResources - the string containing comma-separated resource stringspublic Resource[] getResources()
public void setResources(Resource[] resources)
resources - the new resource arraypublic void setResourcesAsCSV(String csvResources)
csvResources - the comma-separated string containing
one or more resource strings.public Resource addPath(String path) throws IOException, MalformedURLException
ResourceaddPath in class Resourcepath - The path segment to addIOException - if unable to resolve the pathMalformedURLException - if the resolution of the path fails because the input path parameter is malformed.protected Object findResource(String path) throws IOException, MalformedURLException
path - the path to look forIOException - if unable to look for pathMalformedURLException - if failed to look for path due to url issuepublic boolean delete()
throws SecurityException
Resourcedelete in class ResourceSecurityException - if unable to delete due to permissionspublic boolean exists()
public File getFile() throws IOException
ResourcegetFile in class ResourceIOException - if unable to get the resource due to permissionspublic InputStream getInputStream() throws IOException
ResourcegetInputStream in class ResourceIOException - if unable to open the input streampublic ReadableByteChannel getReadableByteChannel() throws IOException
ResourcegetReadableByteChannel in class ResourceIOException - if unable to open the readable bytechannel for the resource.public boolean isDirectory()
isDirectory in class Resourcepublic long lastModified()
ResourcelastModified in class Resourcepublic long length()
Resourcepublic String[] list()
Resourcepublic void close()
Resourcepublic boolean renameTo(Resource dest) throws SecurityException
ResourcerenameTo in class Resourcedest - the destination name for the resourceSecurityException - if unable to rename due to permissionspublic void copyTo(File destination) throws IOException
ResourceWill not replace existing destination file.
copyTo in class Resourcedestination - the destination file to createIOException - if unable to copy the resourcepublic String toString()
public boolean isContainedIn(Resource r) throws MalformedURLException
isContainedIn in class ResourceMalformedURLExceptionCopyright © 1995–2017 Webtide. All rights reserved.