org.jboss.shrinkwrap.api.asset
Class ClassLoaderAsset

java.lang.Object
  extended by org.jboss.shrinkwrap.api.asset.ClassLoaderAsset
All Implemented Interfaces:
Asset

public class ClassLoaderAsset
extends Object
implements Asset

ClassloaderAsset Implementation of a Asset backed by a resource located in the Classloader.

Author:
Aslak Knutsen

Constructor Summary
ClassLoaderAsset(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
 InputStream openStream()
          Opens up the given resource as a stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassLoaderAsset

public ClassLoaderAsset(String resourceName)
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 null
IllegalArgumentException - resourceName must be found in given classloader

ClassLoaderAsset

public ClassLoaderAsset(String resourceName,
                        ClassLoader classLoader)
Load a named resource using the given classloader.

Parameters:
resourceName - The name of the resource to load
classLoader - The ClassLoader to use
Throws:
IllegalArgumentException - resourceName can not be null
IllegalArgumentException - classloader can not be null
IllegalArgumentException - resourceName must be found in given classloader
Method Detail

openStream

public InputStream openStream()
Opens up the given resource as a stream.

Specified by:
openStream in interface Asset
Returns:
A new open InputStream for each call, or null if this type simply represents a logical path within an Archive


Copyright © 2012 JBoss by Red Hat. All Rights Reserved.