Class ResourceFinder
- java.lang.Object
-
- org.codehaus.commons.compiler.util.resource.ResourceFinder
-
- Direct Known Subclasses:
ListableResourceFinder,ZipFileResourceFinder
public abstract class ResourceFinder extends java.lang.ObjectFinds a resource by name.Notice that there is a symmetrical concept
ResourceCreatorthat creates resources for writing.
-
-
Field Summary
Fields Modifier and Type Field Description static ListableResourceFinderEMPTY_RESOURCE_FINDERThis 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 ResourcefindResource(java.lang.String resourceName)Finds a resource by name and return it as aResourceobject.java.io.InputStreamfindResourceAsStream(java.lang.String resourceName)Finds a resource by name and open it for reading.
-
-
-
Field Detail
-
EMPTY_RESOURCE_FINDER
public static final ListableResourceFinder EMPTY_RESOURCE_FINDER
This one's useful when a resource finder is required, but cannot be created for some reason.
-
-
Method Detail
-
findResourceAsStream
@Nullable public final java.io.InputStream findResourceAsStream(java.lang.String resourceName) throws java.io.IOException
Finds 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:
nullif the resource could not be found- Throws:
java.io.IOException- The resource was found, but there are problems opening it
-
findResource
@Nullable public abstract Resource findResource(java.lang.String resourceName)
Finds a resource by name and return it as aResourceobject.- Parameters:
resourceName- Designates the resource; typically structured by slashes ("/") like "com/foo/pkg/Bar.class"- Returns:
nullif the resource could not be found
-
-