Class MapResourceFinder
java.lang.Object
org.codehaus.commons.compiler.util.resource.ResourceFinder
org.codehaus.commons.compiler.util.resource.ListableResourceFinder
org.codehaus.commons.compiler.util.resource.MapResourceFinder
A
ResourceFinder that provides access to resource stored as
byte arrays in a Map.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate longFields inherited from class ResourceFinder
EMPTY_RESOURCE_FINDER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddResource(String fileName, byte[] data) Adds anotherResource, so that it can later be found withfindResource(String),ResourceFinder.findResourceAsStream(String)andresources().addResource(String fileName, String data) addResource(Resource resource) Adds anotherResource, so that it can later be found withfindResource(String),ResourceFinder.findResourceAsStream(String)andresources().final ResourcefindResource(String resourceName) Finds a resource by name and return it as aResourceobject.Returns all resources who's names start with a given string.final voidsetLastModified(long lastModified) Methods inherited from class ResourceFinder
findResourceAsStream
-
Field Details
-
map
-
lastModified
private long lastModified
-
-
Constructor Details
-
MapResourceFinder
public MapResourceFinder() -
MapResourceFinder
-
-
Method Details
-
addResource
Adds anotherResource, so that it can later be found withfindResource(String),ResourceFinder.findResourceAsStream(String)andresources().- Returns:
- The resource that was previously associated with the fileName, or
null
-
addResource
-
addResource
Adds anotherResource, so that it can later be found withfindResource(String),ResourceFinder.findResourceAsStream(String)andresources().- Returns:
- The resource that was previously associated with the fileName, or
null
-
resources
- Returns:
- All resources that were previously added with
addResource(Resource)
-
setLastModified
public final void setLastModified(long lastModified) - Parameters:
lastModified- The return value ofResource.lastModified()for the next resources added
-
findResource
Description copied from class:ResourceFinderFinds a resource by name and return it as aResourceobject.- Specified by:
findResourcein classResourceFinder- Parameters:
resourceName- Designates the resource; typically structured by slashes ("/") like "com/foo/pkg/Bar.class"- Returns:
nullif the resource could not be found
-
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
-