Class ResourceFinder
- java.lang.Object
-
- org.codehaus.janino.util.resource.ResourceFinder
-
- Direct Known Subclasses:
FileResourceFinder
,MapResourceFinder
,MultiResourceFinder
,ZipFileResourceFinder
public abstract class ResourceFinder extends Object
Finds a resource by name.Notice that there is a symmetrical concept
ResourceCreator
that creates resources for writing.- See Also:
ResourceCreator
-
-
Field Summary
Fields Modifier and Type Field Description static ResourceFinder
EMPTY_RESOURCE_FINDER
This one's useful when a resource finder is required, but cannot be created for some reason.
-
Constructor Summary
Constructors Constructor Description ResourceFinder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Resource
findResource(String resourceName)
Find a resource by name and return it as aResource
object.InputStream
findResourceAsStream(String resourceName)
Find a resource by name and open it for reading.
-
-
-
Field Detail
-
EMPTY_RESOURCE_FINDER
public static final ResourceFinder EMPTY_RESOURCE_FINDER
This one's useful when a resource finder is required, but cannot be created for some reason.
-
-
Method Detail
-
findResourceAsStream
public final InputStream findResourceAsStream(String resourceName) throws IOException
Find a resource by name and open it for reading.- Parameters:
resourceName
- Designates the resource; typically structured by slashes ("/") like "com/foo/pkg/Bar.class
"- Returns:
null
if the resource could not be found- Throws:
IOException
- The resource was found, but there are problems opening it
-
findResource
public abstract Resource findResource(String resourceName)
Find a resource by name and return it as aResource
object.- Parameters:
resourceName
- Designates the resource; typically structured by slashes ("/") like "com/foo/pkg/Bar.class
"- Returns:
null
if the resource could not be found
-
-