Class DirectoryResourceFinder
java.lang.Object
org.codehaus.commons.compiler.util.resource.ResourceFinder
org.codehaus.commons.compiler.util.resource.ListableResourceFinder
org.codehaus.commons.compiler.util.resource.FileResourceFinder
org.codehaus.commons.compiler.util.resource.DirectoryResourceFinder
A
FileResourceFinder that finds file resources in a directory. The name of
the file is constructed by concatenating a dirctory name with the resource name such that slashes in the resource
name map to file separators.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final FileKeys don't have trailing file separators (like "dir\").Fields inherited from class ResourceFinder
EMPTY_RESOURCE_FINDER -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class FileResourceFinder
findResourceMethods inherited from class ResourceFinder
findResourceAsStream
-
Field Details
-
directory
-
subdirectoryNameToFiles
-
-
Constructor Details
-
DirectoryResourceFinder
- Parameters:
directory- the directory to use as the search base
-
-
Method Details
-
toString
-
findResourceAsFile
Description copied from class:FileResourceFinderConverts a given resource resource name into aFile.- Specified by:
findResourceAsFilein classFileResourceFinder
-
listFiles
-
list
Description copied from class:ListableResourceFinderReturns all resources who's names start with a given string. Only resources with a content are included, no "special entries" of any kind, e.g. directories.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/fileOtherwise, 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- Specified by:
listin classListableResourceFinder- Parameters:
resourceNamePrefix- E.g.""or"java/lang/"- Returns:
- All resources who's name starts with the given prefix;
nulliff a location designated by the resourceNamePrefix does not exist
-