public class MultiResourceFinder extends ListableResourceFinder
ResourceFinder that finds its resources through a collection of
other ResourceFinders.EMPTY_RESOURCE_FINDER| Constructor and Description |
|---|
MultiResourceFinder(Iterable<? extends ResourceFinder> resourceFinders) |
MultiResourceFinder(ResourceFinder... resourceFinders) |
| Modifier and Type | Method and Description |
|---|---|
Resource |
findResource(String resourceName)
Finds a resource by name and return it as a
Resource object. |
Iterable<Resource> |
list(String resourceNamePrefix,
boolean recurse)
Returns all resources who's names start with a given string.
|
findResourceAsStreampublic MultiResourceFinder(Iterable<? extends ResourceFinder> resourceFinders)
resourceFinders - The entries of the "path"public MultiResourceFinder(ResourceFinder... resourceFinders)
resourceFinders - The entries of the "path"@Nullable public final Resource findResource(String resourceName)
ResourceFinderResource object.findResource in class ResourceFinderresourceName - Designates the resource; typically structured by slashes ("/") like
"com/foo/pkg/Bar.class"null if the resource could not be found@Nullable public Iterable<Resource> list(String resourceNamePrefix, boolean recurse) throws IOException
ListableResourceFinder
If the prefix string ends with "/", you will get a proper directory listing (recurse=false)
or directory tree (recurse=true). Example:
resourceFinder.list("dir/", true) =>
dir/
dir/afile
dir/bfile
dir/adir/
dir/adir/file
dir/bdir/
dir/bdir/file
Otherwise, you will get a strange subset of a directory listing, resp. directory tree, as follows:
resourceFinder.list("dir/a", true) =>
dir/afile
dir/adir/
dir/adir/file
list in class ListableResourceFinderresourceNamePrefix - E.g. "" or "java/lang/"null iff
a location designated by the resourceNamePrefix does not existIOExceptionCopyright © 2024. All rights reserved.