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
-
public class MapResourceFinder extends ListableResourceFinder
AResourceFinderthat provides access to resource stored as byte arrays in aMap.
-
-
Field Summary
-
Fields inherited from class org.codehaus.commons.compiler.util.resource.ResourceFinder
EMPTY_RESOURCE_FINDER
-
-
Constructor Summary
Constructors Constructor Description MapResourceFinder()MapResourceFinder(Map<String,byte[]> map)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResourceaddResource(String fileName, byte[] data)Adds anotherResource, so that it can later be found withfindResource(String),ResourceFinder.findResourceAsStream(String)andresources().ResourceaddResource(String fileName, String data)ResourceaddResource(Resource resource)Adds anotherResource, so that it can later be found withfindResource(String),ResourceFinder.findResourceAsStream(String)andresources().ResourcefindResource(String resourceName)Finds a resource by name and return it as aResourceobject.Iterable<Resource>list(String resourceNamePrefix, boolean recurse)Collection<Resource>resources()voidsetLastModified(long lastModified)-
Methods inherited from class org.codehaus.commons.compiler.util.resource.ResourceFinder
findResourceAsStream
-
-
-
-
Method Detail
-
addResource
@Nullable public Resource addResource(String fileName, byte[] data)
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
@Nullable public Resource addResource(String fileName, String data)
- Parameters:
data- The text to store (in platform default encoding)- Returns:
- The resource that was previously associated with the fileName, or
null
-
addResource
public Resource addResource(Resource resource)
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
public Collection<Resource> 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
@Nullable public final Resource findResource(String resourceName)
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
-
-