Package org.jboss.shrinkwrap.api.asset
Class ClassLoaderAsset
java.lang.Object
org.jboss.shrinkwrap.api.asset.ClassLoaderAsset
- All Implemented Interfaces:
Asset
ClassloaderAsset
Implementation of a
Asset
backed by a resource located in the Classloader.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionClassLoaderAsset
(String resourceName) Load a named resource using the current threads context classloader.ClassLoaderAsset
(String resourceName, ClassLoader classLoader) Load a named resource using the given classloader. -
Method Summary
Modifier and TypeMethodDescriptionReturns the loaded resource.Opens up the given resource as a stream.
-
Field Details
-
resourceName
-
classLoader
-
-
Constructor Details
-
ClassLoaderAsset
Load a named resource using the current threads context classloader.- Parameters:
resourceName
- The name of the resource to load- Throws:
IllegalArgumentException
- resourceName can not be nullIllegalArgumentException
- resourceName must be found in given classloader
-
ClassLoaderAsset
Load a named resource using the given classloader.- Parameters:
resourceName
- The name of the resource to loadclassLoader
- The ClassLoader to use- Throws:
IllegalArgumentException
- resourceName can not be nullIllegalArgumentException
- classloader can not be nullIllegalArgumentException
- resourceName must be found in given classloader
-
-
Method Details
-
getSource
Returns the loaded resource. -
openStream
Opens up the given resource as a stream.- Specified by:
openStream
in interfaceAsset
- Returns:
- A new open
InputStream
for each call
-